-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to use fragments yet? #286
Comments
Hi @waynew. Inline fragments are indeed not usable in the current release. They will be in the next release, which I'm working on now. Your example would look like this: import quiz
from quiz import SELECTOR as _
schema = ...
stuff = schema.PullRequest[
_.name
]
This is from the inline fragment test case in the new release: class TestInlineFragment:
def test_gql(self):
# fmt: off
fragment = Dog[
_
.name
.bark_volume
.knows_command(command=Command.SIT)
.is_housetrained
.owner[
_.name
]
]
# fmt: on
assert (
gql(fragment)
== dedent(
"""\
... on Dog {
name
bark_volume
knows_command(command: SIT)
is_housetrained
owner {
name
}
}
"""
).strip()
) |
@waynew FYI I'll probably remove python 3.5 support next release as well, since |
As a workaround I was able to do this:
Unfortunately I had to access the result as a dictionary, but at least I could still use the quiz API for building the query. |
InlineFragment exists, but I can't figure out how to use it. I'm assuming that it's supposed to do what I want, and I just figured out how to make it look like what I want:
But when I put it in:
it doesn't work because
assert isinstance(selections, SelectionSet)
fails.I haven't found any examples of how it's supposed to work, though.
The text was updated successfully, but these errors were encountered: