def test_query(self, schema): query = schema.query[_.license(key='MIT')] assert query == quiz.Query(cls=schema.Query, selections=quiz.SelectionSet( quiz.Field('license', {'key': 'MIT'}), )) with pytest.raises(quiz.SelectionError): schema.query[_.foo]
def test_gql(self): op = quiz.Query(Dog, quiz.SelectionSet(Field("name"))) assert (quiz.gql(op) == dedent(""" query { name } """).strip()) assert quiz.gql(op) == str(op)
def test_gql(self): op = quiz.Query(Dog, quiz.SelectionSet(Field('name'))) assert quiz.gql(op) == dedent(''' query { name } ''').strip() assert quiz.gql(op) == str(op)
def test_query(self, schema): query = schema.query[_.license(key="MIT")] assert query == quiz.Query( cls=schema.Query, selections=quiz.SelectionSet(quiz.Field("license", {"key": "MIT"})), ) with pytest.raises(quiz.SelectionError): schema.query[_.foo]
def test_empty(self): selection = quiz.SelectionSet() loaded = quiz.load(DogQuery, selection, {}) assert isinstance(loaded, DogQuery)