Ejemplo n.º 1
0
 def test_scalar_queries_merge_into_scalar_query(self):
     query = schema.Boolean() + schema.Boolean()
     assert_that(query, is_query(schema.Boolean()))
Ejemplo n.º 2
0
 def test_scalar_query_for_type_is_scalar_query(self):
     query = schema.Boolean().for_type(schema.Boolean())
     assert_that(query, is_query(schema.Boolean()))
Ejemplo n.º 3
0
 def test_bool_is_unchanged(self):
     query = schema.Boolean()
     assert_that(query.to_json_value(True), equal_to(True))
Ejemplo n.º 4
0
 def test_cannot_change_type_of_scalar_query(self):
     error = pytest.raises(TypeError, lambda: schema.Boolean().for_type(schema.String))
     assert_that(str(error.value), equal_to("cannot coerce query for Boolean to query for String"))
Ejemplo n.º 5
0
 def test_adding_nullable_query_to_non_null_query_raises_type_error(self):
     pytest.raises(TypeError, lambda: schema.NullableType(schema.Boolean)() + schema.Boolean())
Ejemplo n.º 6
0
 def test_adding__query_to_non_list_query_raises_type_error(self):
     pytest.raises(TypeError, lambda: schema.ListType(schema.Boolean)() + schema.Boolean())
Ejemplo n.º 7
0
 def test_adding_object_query_to_other_query_raises_type_error(self):
     pytest.raises(TypeError, lambda: schema.ObjectType("Obj", fields=()) + schema.Boolean())
Ejemplo n.º 8
0
 def test_adding_scalar_queries_of_different_type_raises_type_error(self):
     error = pytest.raises(TypeError, lambda: schema.Boolean() + schema.Int())
     assert_that(str(error.value), equal_to("cannot add queries for different scalar types: Boolean and Int"))