Conversation
Adds a test to ensure `GraphQLResponse.data` correctly falls back to an empty dictionary `{}` when the response json provides `{'data': None}`.
Also adds tests for `GraphQLResponse.errors` fallback and `GraphQLResponse.query` with a mock request object, bringing the coverage of `src/aiographql/client/response.py` up to 100%.
Co-authored-by: abn <165325+abn@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Review Summary by QodoAdd comprehensive tests for GraphQLResponse edge cases
WalkthroughsDescription• Add tests for GraphQLResponse.data fallback when data is None • Add tests for GraphQLResponse.errors fallback scenarios • Add test for GraphQLResponse.query with GraphQLRequest object • Add test for data_as() method without path parameter • Achieve 100% test coverage for src/aiographql/client/response.py Diagramflowchart LR
A["GraphQLResponse edge cases"] --> B["data fallback with None"]
A --> C["errors fallback scenarios"]
A --> D["query with GraphQLRequest object"]
A --> E["data_as without path"]
B --> F["100% coverage achieved"]
C --> F
D --> F
E --> F
File Changes1. tests/test_response.py
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 📐 Spec deviations (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewⓘ The new review experience is currently in Beta. Learn more |
Updates `apollo-server-v2` and `strawberry-server` to use more stable and modern base image tags (`node:20-alpine` and `python:3.13-slim` respectively) to prevent intermittent HTTP 504 Gateway Time-out errors from Docker Hub during `podman compose up` in CI. Additionally, removes the deprecated `debug-server` extra from the `strawberry-graphql` dependencies to allow successful installations. Co-authored-by: abn <165325+abn@users.noreply.github.com>
🎯 What: The testing gap addressed is the edge case in
GraphQLResponse.datawhen thejsonis initialized with{'data': None}. Due to the wayisinstance(None, dict)evaluates toFalse, the property gracefully falls back to returning an empty dictionary{}, but this behavior lacked explicitly targeted tests.📊 Coverage: The following scenarios are now additionally tested:
GraphQLResponse.datareturning{}when{'data': None}is provided in JSON.GraphQLResponse.errorsreturning[]when{'errors': None}or no'errors'key is present.GraphQLResponse.queryevaluating correctly when initialized with a trueGraphQLRequestobject instead of a string.GraphQLResponse.data_asfunctioning correctly when extracting to a dict without providing a navigation path.✨ Result: The improvement in test coverage increases the test coverage of
src/aiographql/client/response.pyto a full 100%. These tests act as a safety net against regressions in how invalid or semi-valid GraphQL response payloads are handled.PR created automatically by Jules for task 4022231266722643061 started by @abn