back to OpenHands summary
OpenHands : graphene
Pytest Summary for test graphene
status
count
failed
229
passed
83
total
312
collected
312
Failed pytests:
test_connection.py::test_connection
test_connection.py::test_connection
def test_connection():
class MyObjectConnection(Connection):
extra = String()
class Meta:
node = MyObject
class Edge:
other = String()
assert MyObjectConnection._meta.name == "MyObjectConnection"
fields = MyObjectConnection._meta.fields
assert list(fields) == ["page_info", "edges", "extra"]
edge_field = fields["edges"]
pageinfo_field = fields["page_info"]
assert isinstance(edge_field, Field)
> assert isinstance(edge_field.type, NonNull)
E AttributeError: 'Field' object has no attribute 'type'
graphene/relay/tests/test_connection.py:40: AttributeError
test_connection.py::test_connection_extra_abstract_fields
def test_connection_extra_abstract_fields():
class ConnectionWithNodes(Connection):
class Meta:
abstract = True
@classmethod
def __init_subclass_with_meta__(cls, node=None, name=None, **options):
_meta = ConnectionOptions(cls)
_meta.fields = {
"nodes": Field(
NonNull(List(node)),
description="Contains all the nodes in this connection.",
),
}
return super(ConnectionWithNodes, cls).__init_subclass_with_meta__(
node=node, name=name, _meta=_meta, **options
)
class MyObjectConnection(ConnectionWithNodes):
class Meta:
node = MyObject
class Edge:
other = String()
assert MyObjectConnection._meta.name == "MyObjectConnection"
fields = MyObjectConnection._meta.fields
assert list(fields) == ["nodes", "page_info", "edges"]
edge_field = fields["edges"]
pageinfo_field = fields["page_info"]
nodes_field = fields["nodes"]
assert isinstance(edge_field, Field)
> assert isinstance(edge_field.type, NonNull)
E AttributeError: 'Field' object has no attribute 'type'
graphene/relay/tests/test_connection.py:97: AttributeError
test_connection.py::test_connection_override_fields
test_connection.py::test_connection_override_fields
def test_connection_override_fields():
class ConnectionWithNodes(Connection):
class Meta:
abstract = True
@classmethod
def __init_subclass_with_meta__(cls, node=None, name=None, **options):
_meta = ConnectionOptions(cls)
base_name = (
re.sub("Connection$", "", name or cls.__name__) or node._meta.name
)
edge_class = get_edge_class(cls, node, base_name)
_meta.fields = {
"page_info": Field(
NonNull(
PageInfo,
name="pageInfo",
required=True,
description="Pagination data for this connection.",
)
),
"edges": Field(
NonNull(List(NonNull(edge_class))),
description="Contains the nodes in this connection.",
),
}
return super(ConnectionWithNodes, cls).__init_subclass_with_meta__(
node=node, name=name, _meta=_meta, **options
)
class MyObjectConnection(ConnectionWithNodes):
class Meta:
node = MyObject
assert MyObjectConnection._meta.name == "MyObjectConnection"
fields = MyObjectConnection._meta.fields
assert list(fields) == ["page_info", "edges"]
edge_field = fields["edges"]
pageinfo_field = fields["page_info"]
assert isinstance(edge_field, Field)
> assert isinstance(edge_field.type, NonNull)
E AttributeError: 'Field' object has no attribute 'type'
graphene/relay/tests/test_connection.py:155: AttributeError
test_connection.py::test_edge
test_connection.py::test_edge
def test_edge():
class MyObjectConnection(Connection):
class Meta:
node = MyObject
class Edge:
other = String()
Edge = MyObjectConnection.Edge
> assert Edge._meta.name == "MyObjectEdge"
E AssertionError: assert 'EdgeBase' == 'MyObjectEdge'
E
E - MyObjectEdge
E + EdgeBase
graphene/relay/tests/test_connection.py:190: AssertionError
test_connection.py::test_edge_with_bases
test_connection.py::test_edge_with_bases
def test_edge_with_bases():
class BaseEdge:
extra = String()
class MyObjectConnection(Connection):
class Meta:
node = MyObject
class Edge(BaseEdge):
other = String()
Edge = MyObjectConnection.Edge
> assert Edge._meta.name == "MyObjectEdge"
E AssertionError: assert 'EdgeBase' == 'MyObjectEdge'
E
E - MyObjectEdge
E + EdgeBase
graphene/relay/tests/test_connection.py:213: AssertionError
test_connection.py::test_edge_with_nonnull_node
test_connection.py::test_edge_with_nonnull_node
def test_edge_with_nonnull_node():
class MyObjectConnection(Connection):
class Meta:
node = NonNull(MyObject)
edge_fields = MyObjectConnection.Edge._meta.fields
assert isinstance(edge_fields["node"], Field)
> assert isinstance(edge_fields["node"].type, NonNull)
E AttributeError: 'Field' object has no attribute 'type'
graphene/relay/tests/test_connection.py:231: AttributeError
test_connection.py::test_connectionfield
test_connection.py::test_connectionfield
def test_connectionfield():
class MyObjectConnection(Connection):
class Meta:
node = MyObject
field = ConnectionField(MyObjectConnection)
> assert field.args == {
"before": Argument(String),
"after": Argument(String),
"first": Argument(Int),
"last": Argument(Int),
}
E AssertionError: assert [] == {'after': }
E
E Use -v to get more diff
graphene/relay/tests/test_connection.py:252: AssertionError
test_connection.py::test_connectionfield_node_deprecated
test_connection.py::test_connectionfield_node_deprecated
def test_connectionfield_node_deprecated():
field = ConnectionField(MyObject)
with raises(Exception) as exc_info:
field.type
> assert "ConnectionFields now need a explicit ConnectionType for Nodes." in str(
exc_info.value
)
E assert 'ConnectionFields now need a explicit ConnectionType for Nodes.' in "'IterableConnectionField' object has no attribute 'type'"
E + where "'IterableConnectionField' object has no attribute 'type'" = str(AttributeError("'IterableConnectionField' object has no attribute 'type'"))
E + where AttributeError("'IterableConnectionField' object has no attribute 'type'") = .value
graphene/relay/tests/test_connection.py:265: AssertionError
test_connection.py::test_connectionfield_custom_args
test_connection.py::test_connectionfield_custom_args
def test_connectionfield_custom_args():
class MyObjectConnection(Connection):
class Meta:
node = MyObject
field = ConnectionField(
MyObjectConnection, before=String(required=True), extra=String()
)
> assert field.args == {
"before": Argument(NonNull(String)),
"after": Argument(String),
"first": Argument(Int),
"last": Argument(Int),
"extra": Argument(String),
}
E AssertionError: assert [] == {'after': , ...}
E
E Use -v to get more diff
graphene/relay/tests/test_connection.py:278: AssertionError
test_connection.py::test_connectionfield_required
test_connection.py::test_connectionfield_required
def test_connectionfield_required():
class MyObjectConnection(Connection):
class Meta:
node = MyObject
class Query(ObjectType):
test_connection = ConnectionField(MyObjectConnection, required=True)
def resolve_test_connection(root, info, **args):
return []
> schema = Schema(query=Query)
graphene/relay/tests/test_connection.py:298:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_connection.py::test_connectionfield_strict_types
test_connection.py::test_connectionfield_strict_types
def test_connectionfield_strict_types():
class MyObjectConnection(Connection):
class Meta:
node = MyObject
strict_types = True
connection_field = ConnectionField(MyObjectConnection)
> edges_field_type = connection_field.type._meta.fields["edges"].type
E AttributeError: 'IterableConnectionField' object has no attribute 'type'
graphene/relay/tests/test_connection.py:311: AttributeError
test_custom_global_id.py::TestUUIDGlobalID::test_str_schema_correct
test_custom_global_id.py::TestUUIDGlobalID::test_str_schema_correct
self =
def test_str_schema_correct(self):
"""
Check that the schema has the expected and custom node interface and user type and that they both use UUIDs
"""
> parsed = re.findall(r"(.+) \{\n\s*([\w\W]*?)\n\}", str(self.schema))
E AttributeError: 'TestUUIDGlobalID' object has no attribute 'schema'
graphene/relay/tests/test_custom_global_id.py:45: AttributeError
test_custom_global_id.py::TestUUIDGlobalID::test_get_by_id
test_custom_global_id.py::TestUUIDGlobalID::test_get_by_id
self =
def test_get_by_id(self):
query = """query userById($id: UUID!) {
user(id: $id) {
id
name
}
}"""
# UUID need to be converted to string for serialization
result = graphql_sync(
> self.graphql_schema,
query,
variable_values={"id": str(self.user_list[0]["id"])},
)
E AttributeError: 'TestUUIDGlobalID' object has no attribute 'graphql_schema'
graphene/relay/tests/test_custom_global_id.py:70: AttributeError
test_custom_global_id.py::TestSimpleGlobalID::test_str_schema_correct
test_custom_global_id.py::TestSimpleGlobalID::test_str_schema_correct
self =
def test_str_schema_correct(self):
"""
Check that the schema has the expected and custom node interface and user type and that they both use UUIDs
"""
> parsed = re.findall(r"(.+) \{\n\s*([\w\W]*?)\n\}", str(self.schema))
E AttributeError: 'TestSimpleGlobalID' object has no attribute 'schema'
graphene/relay/tests/test_custom_global_id.py:113: AttributeError
test_custom_global_id.py::TestSimpleGlobalID::test_get_by_id
test_custom_global_id.py::TestSimpleGlobalID::test_get_by_id
self =
def test_get_by_id(self):
query = """query {
user(id: "my global primary key in clear 3") {
id
name
}
}"""
> result = graphql_sync(self.graphql_schema, query)
E AttributeError: 'TestSimpleGlobalID' object has no attribute 'graphql_schema'
graphene/relay/tests/test_custom_global_id.py:136: AttributeError
test_custom_global_id.py::TestCustomGlobalID::test_str_schema_correct
test_custom_global_id.py::TestCustomGlobalID::test_str_schema_correct
self =
def test_str_schema_correct(self):
"""
Check that the schema has the expected and custom node interface and user type and that they both use UUIDs
"""
> parsed = re.findall(r"(.+) \{\n\s*([\w\W]*?)\n\}", str(self.schema))
E AttributeError: 'TestCustomGlobalID' object has no attribute 'schema'
graphene/relay/tests/test_custom_global_id.py:192: AttributeError
test_custom_global_id.py::TestCustomGlobalID::test_get_by_id
test_custom_global_id.py::TestCustomGlobalID::test_get_by_id
self =
def test_get_by_id(self):
query = """query {
user(id: 2) {
id
name
}
}"""
> result = graphql_sync(self.graphql_schema, query)
E AttributeError: 'TestCustomGlobalID' object has no attribute 'graphql_schema'
graphene/relay/tests/test_custom_global_id.py:215: AttributeError
test_custom_global_id.py::TestIncompleteCustomGlobalID::test_must_define_to_global_id
test_custom_global_id.py::TestIncompleteCustomGlobalID::test_must_define_to_global_id
self =
def test_must_define_to_global_id(self):
"""
Test that if the `to_global_id` method is not defined, we can query the object, but we can't request its ID.
"""
class CustomGlobalIDType(BaseGlobalIDType):
graphene_type = Int
@classmethod
def resolve_global_id(cls, info, global_id):
_type = info.return_type.graphene_type._meta.name
return _type, global_id
class CustomNode(Node):
class Meta:
global_id_type = CustomGlobalIDType
class User(ObjectType):
class Meta:
interfaces = [CustomNode]
name = String()
@classmethod
def get_node(cls, _type, _id):
return self.users[_id]
class RootQuery(ObjectType):
user = CustomNode.Field(User)
> self.schema = Schema(query=RootQuery, types=[User])
graphene/relay/tests/test_custom_global_id.py:261:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None
types = [>], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_custom_global_id.py::TestIncompleteCustomGlobalID::test_must_define_resolve_global_id
test_custom_global_id.py::TestIncompleteCustomGlobalID::test_must_define_resolve_global_id
self =
def test_must_define_resolve_global_id(self):
"""
Test that if the `resolve_global_id` method is not defined, we can't query the object by ID.
"""
class CustomGlobalIDType(BaseGlobalIDType):
graphene_type = Int
@classmethod
def to_global_id(cls, _type, _id):
return _id
class CustomNode(Node):
class Meta:
global_id_type = CustomGlobalIDType
class User(ObjectType):
class Meta:
interfaces = [CustomNode]
name = String()
@classmethod
def get_node(cls, _type, _id):
return self.users[_id]
class RootQuery(ObjectType):
user = CustomNode.Field(User)
> self.schema = Schema(query=RootQuery, types=[User])
graphene/relay/tests/test_custom_global_id.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None
types = [>], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_global_id.py::test_global_id_defaults_to_required_and_node
test_global_id.py::test_global_id_defaults_to_required_and_node
def test_global_id_defaults_to_required_and_node():
gid = GlobalID()
> assert isinstance(gid.type, NonNull)
E AttributeError: 'GlobalID' object has no attribute 'type'
graphene/relay/tests/test_global_id.py:34: AttributeError
test_global_id.py::test_global_id_allows_overriding_of_node_and_required
test_global_id.py::test_global_id_allows_overriding_of_node_and_required
def test_global_id_allows_overriding_of_node_and_required():
gid = GlobalID(node=CustomNode, required=False)
> assert gid.type == ID
E AttributeError: 'GlobalID' object has no attribute 'type'
graphene/relay/tests/test_global_id.py:41: AttributeError
test_global_id.py::test_global_id_defaults_to_info_parent_type
test_global_id.py::test_global_id_defaults_to_info_parent_type
def test_global_id_defaults_to_info_parent_type():
my_id = "1"
gid = GlobalID()
id_resolver = gid.wrap_resolve(lambda *_: my_id)
> my_global_id = id_resolver(None, Info(User))
E TypeError: 'NoneType' object is not callable
graphene/relay/tests/test_global_id.py:49: TypeError
test_global_id.py::test_global_id_allows_setting_customer_parent_type
test_global_id.py::test_global_id_allows_setting_customer_parent_type
def test_global_id_allows_setting_customer_parent_type():
my_id = "1"
gid = GlobalID(parent_type=User)
id_resolver = gid.wrap_resolve(lambda *_: my_id)
> my_global_id = id_resolver(None, None)
E TypeError: 'NoneType' object is not callable
graphene/relay/tests/test_global_id.py:57: TypeError
test_1293.py::test_schema_printable_with_default_datetime_value
test_1293.py::test_schema_printable_with_default_datetime_value
def test_schema_printable_with_default_datetime_value():
> schema = graphene.Schema(query=Query, mutation=Mutations)
graphene/tests/issues/test_1293.py:39:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = >
subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_1419.py::test_parse_literal_with_variables[Date-"2022-02-02"]
test_1419.py::test_parse_literal_with_variables[Date-"2022-02-02"]
input_type = >
input_value = '"2022-02-02"'
@pytest.mark.parametrize(
"input_type,input_value",
[
(Date, '"2022-02-02"'),
(GenericScalar, '"foo"'),
(Int, "1"),
(BigInt, "12345678901234567890"),
(Float, "1.1"),
(String, '"foo"'),
(Boolean, "true"),
(ID, "1"),
(DateTime, '"2022-02-02T11:11:11"'),
(UUID, '"cbebbc62-758e-4f75-a890-bc73b5017d81"'),
(Decimal, '"1.1"'),
(JSONString, '"{\\"key\\":\\"foo\\",\\"value\\":\\"bar\\"}"'),
(Base64, '"Q2hlbG8gd29ycmxkCg=="'),
],
)
def test_parse_literal_with_variables(input_type, input_value):
# input_b needs to be evaluated as literal while the variable dict for
# input_a is passed along.
class Query(ObjectType):
generic = GenericScalar(input_a=GenericScalar(), input_b=input_type())
def resolve_generic(self, info, input_a=None, input_b=None):
return input
> schema = Schema(query=Query)
graphene/tests/issues/test_1419.py:42:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_1419.py::test_parse_literal_with_variables[GenericScalar-"foo"]
test_1419.py::test_parse_literal_with_variables[GenericScalar-"foo"]
input_type = >
input_value = '"foo"'
@pytest.mark.parametrize(
"input_type,input_value",
[
(Date, '"2022-02-02"'),
(GenericScalar, '"foo"'),
(Int, "1"),
(BigInt, "12345678901234567890"),
(Float, "1.1"),
(String, '"foo"'),
(Boolean, "true"),
(ID, "1"),
(DateTime, '"2022-02-02T11:11:11"'),
(UUID, '"cbebbc62-758e-4f75-a890-bc73b5017d81"'),
(Decimal, '"1.1"'),
(JSONString, '"{\\"key\\":\\"foo\\",\\"value\\":\\"bar\\"}"'),
(Base64, '"Q2hlbG8gd29ycmxkCg=="'),
],
)
def test_parse_literal_with_variables(input_type, input_value):
# input_b needs to be evaluated as literal while the variable dict for
# input_a is passed along.
class Query(ObjectType):
generic = GenericScalar(input_a=GenericScalar(), input_b=input_type())
def resolve_generic(self, info, input_a=None, input_b=None):
return input
> schema = Schema(query=Query)
graphene/tests/issues/test_1419.py:42:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_1419.py::test_parse_literal_with_variables[Int-1]
test_1419.py::test_parse_literal_with_variables[Int-1]
input_type = >, input_value = '1'
@pytest.mark.parametrize(
"input_type,input_value",
[
(Date, '"2022-02-02"'),
(GenericScalar, '"foo"'),
(Int, "1"),
(BigInt, "12345678901234567890"),
(Float, "1.1"),
(String, '"foo"'),
(Boolean, "true"),
(ID, "1"),
(DateTime, '"2022-02-02T11:11:11"'),
(UUID, '"cbebbc62-758e-4f75-a890-bc73b5017d81"'),
(Decimal, '"1.1"'),
(JSONString, '"{\\"key\\":\\"foo\\",\\"value\\":\\"bar\\"}"'),
(Base64, '"Q2hlbG8gd29ycmxkCg=="'),
],
)
def test_parse_literal_with_variables(input_type, input_value):
# input_b needs to be evaluated as literal while the variable dict for
# input_a is passed along.
class Query(ObjectType):
generic = GenericScalar(input_a=GenericScalar(), input_b=input_type())
def resolve_generic(self, info, input_a=None, input_b=None):
return input
> schema = Schema(query=Query)
graphene/tests/issues/test_1419.py:42:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_1419.py::test_parse_literal_with_variables[BigInt-12345678901234567890]
test_1419.py::test_parse_literal_with_variables[BigInt-12345678901234567890]
input_type = >
input_value = '12345678901234567890'
@pytest.mark.parametrize(
"input_type,input_value",
[
(Date, '"2022-02-02"'),
(GenericScalar, '"foo"'),
(Int, "1"),
(BigInt, "12345678901234567890"),
(Float, "1.1"),
(String, '"foo"'),
(Boolean, "true"),
(ID, "1"),
(DateTime, '"2022-02-02T11:11:11"'),
(UUID, '"cbebbc62-758e-4f75-a890-bc73b5017d81"'),
(Decimal, '"1.1"'),
(JSONString, '"{\\"key\\":\\"foo\\",\\"value\\":\\"bar\\"}"'),
(Base64, '"Q2hlbG8gd29ycmxkCg=="'),
],
)
def test_parse_literal_with_variables(input_type, input_value):
# input_b needs to be evaluated as literal while the variable dict for
# input_a is passed along.
class Query(ObjectType):
generic = GenericScalar(input_a=GenericScalar(), input_b=input_type())
def resolve_generic(self, info, input_a=None, input_b=None):
return input
> schema = Schema(query=Query)
graphene/tests/issues/test_1419.py:42:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_1419.py::test_parse_literal_with_variables[Float-1.1]
test_1419.py::test_parse_literal_with_variables[Float-1.1]
input_type = >, input_value = '1.1'
@pytest.mark.parametrize(
"input_type,input_value",
[
(Date, '"2022-02-02"'),
(GenericScalar, '"foo"'),
(Int, "1"),
(BigInt, "12345678901234567890"),
(Float, "1.1"),
(String, '"foo"'),
(Boolean, "true"),
(ID, "1"),
(DateTime, '"2022-02-02T11:11:11"'),
(UUID, '"cbebbc62-758e-4f75-a890-bc73b5017d81"'),
(Decimal, '"1.1"'),
(JSONString, '"{\\"key\\":\\"foo\\",\\"value\\":\\"bar\\"}"'),
(Base64, '"Q2hlbG8gd29ycmxkCg=="'),
],
)
def test_parse_literal_with_variables(input_type, input_value):
# input_b needs to be evaluated as literal while the variable dict for
# input_a is passed along.
class Query(ObjectType):
generic = GenericScalar(input_a=GenericScalar(), input_b=input_type())
def resolve_generic(self, info, input_a=None, input_b=None):
return input
> schema = Schema(query=Query)
graphene/tests/issues/test_1419.py:42:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_1419.py::test_parse_literal_with_variables[String-"foo"]
test_1419.py::test_parse_literal_with_variables[String-"foo"]
input_type = >, input_value = '"foo"'
@pytest.mark.parametrize(
"input_type,input_value",
[
(Date, '"2022-02-02"'),
(GenericScalar, '"foo"'),
(Int, "1"),
(BigInt, "12345678901234567890"),
(Float, "1.1"),
(String, '"foo"'),
(Boolean, "true"),
(ID, "1"),
(DateTime, '"2022-02-02T11:11:11"'),
(UUID, '"cbebbc62-758e-4f75-a890-bc73b5017d81"'),
(Decimal, '"1.1"'),
(JSONString, '"{\\"key\\":\\"foo\\",\\"value\\":\\"bar\\"}"'),
(Base64, '"Q2hlbG8gd29ycmxkCg=="'),
],
)
def test_parse_literal_with_variables(input_type, input_value):
# input_b needs to be evaluated as literal while the variable dict for
# input_a is passed along.
class Query(ObjectType):
generic = GenericScalar(input_a=GenericScalar(), input_b=input_type())
def resolve_generic(self, info, input_a=None, input_b=None):
return input
> schema = Schema(query=Query)
graphene/tests/issues/test_1419.py:42:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_1419.py::test_parse_literal_with_variables[Boolean-true]
test_1419.py::test_parse_literal_with_variables[Boolean-true]
input_type = >, input_value = 'true'
@pytest.mark.parametrize(
"input_type,input_value",
[
(Date, '"2022-02-02"'),
(GenericScalar, '"foo"'),
(Int, "1"),
(BigInt, "12345678901234567890"),
(Float, "1.1"),
(String, '"foo"'),
(Boolean, "true"),
(ID, "1"),
(DateTime, '"2022-02-02T11:11:11"'),
(UUID, '"cbebbc62-758e-4f75-a890-bc73b5017d81"'),
(Decimal, '"1.1"'),
(JSONString, '"{\\"key\\":\\"foo\\",\\"value\\":\\"bar\\"}"'),
(Base64, '"Q2hlbG8gd29ycmxkCg=="'),
],
)
def test_parse_literal_with_variables(input_type, input_value):
# input_b needs to be evaluated as literal while the variable dict for
# input_a is passed along.
class Query(ObjectType):
generic = GenericScalar(input_a=GenericScalar(), input_b=input_type())
def resolve_generic(self, info, input_a=None, input_b=None):
return input
> schema = Schema(query=Query)
graphene/tests/issues/test_1419.py:42:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_1419.py::test_parse_literal_with_variables[ID-1]
test_1419.py::test_parse_literal_with_variables[ID-1]
input_type = >, input_value = '1'
@pytest.mark.parametrize(
"input_type,input_value",
[
(Date, '"2022-02-02"'),
(GenericScalar, '"foo"'),
(Int, "1"),
(BigInt, "12345678901234567890"),
(Float, "1.1"),
(String, '"foo"'),
(Boolean, "true"),
(ID, "1"),
(DateTime, '"2022-02-02T11:11:11"'),
(UUID, '"cbebbc62-758e-4f75-a890-bc73b5017d81"'),
(Decimal, '"1.1"'),
(JSONString, '"{\\"key\\":\\"foo\\",\\"value\\":\\"bar\\"}"'),
(Base64, '"Q2hlbG8gd29ycmxkCg=="'),
],
)
def test_parse_literal_with_variables(input_type, input_value):
# input_b needs to be evaluated as literal while the variable dict for
# input_a is passed along.
class Query(ObjectType):
generic = GenericScalar(input_a=GenericScalar(), input_b=input_type())
def resolve_generic(self, info, input_a=None, input_b=None):
return input
> schema = Schema(query=Query)
graphene/tests/issues/test_1419.py:42:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_1419.py::test_parse_literal_with_variables[DateTime-"2022-02-02T11:11:11"]
test_1419.py::test_parse_literal_with_variables[DateTime-"2022-02-02T11:11:11"]
input_type = >
input_value = '"2022-02-02T11:11:11"'
@pytest.mark.parametrize(
"input_type,input_value",
[
(Date, '"2022-02-02"'),
(GenericScalar, '"foo"'),
(Int, "1"),
(BigInt, "12345678901234567890"),
(Float, "1.1"),
(String, '"foo"'),
(Boolean, "true"),
(ID, "1"),
(DateTime, '"2022-02-02T11:11:11"'),
(UUID, '"cbebbc62-758e-4f75-a890-bc73b5017d81"'),
(Decimal, '"1.1"'),
(JSONString, '"{\\"key\\":\\"foo\\",\\"value\\":\\"bar\\"}"'),
(Base64, '"Q2hlbG8gd29ycmxkCg=="'),
],
)
def test_parse_literal_with_variables(input_type, input_value):
# input_b needs to be evaluated as literal while the variable dict for
# input_a is passed along.
class Query(ObjectType):
generic = GenericScalar(input_a=GenericScalar(), input_b=input_type())
def resolve_generic(self, info, input_a=None, input_b=None):
return input
> schema = Schema(query=Query)
graphene/tests/issues/test_1419.py:42:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_1419.py::test_parse_literal_with_variables[UUID-"cbebbc62-758e-4f75-a890-bc73b5017d81"]
test_1419.py::test_parse_literal_with_variables[UUID-"cbebbc62-758e-4f75-a890-bc73b5017d81"]
input_type = >
input_value = '"cbebbc62-758e-4f75-a890-bc73b5017d81"'
@pytest.mark.parametrize(
"input_type,input_value",
[
(Date, '"2022-02-02"'),
(GenericScalar, '"foo"'),
(Int, "1"),
(BigInt, "12345678901234567890"),
(Float, "1.1"),
(String, '"foo"'),
(Boolean, "true"),
(ID, "1"),
(DateTime, '"2022-02-02T11:11:11"'),
(UUID, '"cbebbc62-758e-4f75-a890-bc73b5017d81"'),
(Decimal, '"1.1"'),
(JSONString, '"{\\"key\\":\\"foo\\",\\"value\\":\\"bar\\"}"'),
(Base64, '"Q2hlbG8gd29ycmxkCg=="'),
],
)
def test_parse_literal_with_variables(input_type, input_value):
# input_b needs to be evaluated as literal while the variable dict for
# input_a is passed along.
class Query(ObjectType):
generic = GenericScalar(input_a=GenericScalar(), input_b=input_type())
def resolve_generic(self, info, input_a=None, input_b=None):
return input
> schema = Schema(query=Query)
graphene/tests/issues/test_1419.py:42:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_1419.py::test_parse_literal_with_variables[Decimal-"1.1"]
test_1419.py::test_parse_literal_with_variables[Decimal-"1.1"]
input_type = >
input_value = '"1.1"'
@pytest.mark.parametrize(
"input_type,input_value",
[
(Date, '"2022-02-02"'),
(GenericScalar, '"foo"'),
(Int, "1"),
(BigInt, "12345678901234567890"),
(Float, "1.1"),
(String, '"foo"'),
(Boolean, "true"),
(ID, "1"),
(DateTime, '"2022-02-02T11:11:11"'),
(UUID, '"cbebbc62-758e-4f75-a890-bc73b5017d81"'),
(Decimal, '"1.1"'),
(JSONString, '"{\\"key\\":\\"foo\\",\\"value\\":\\"bar\\"}"'),
(Base64, '"Q2hlbG8gd29ycmxkCg=="'),
],
)
def test_parse_literal_with_variables(input_type, input_value):
# input_b needs to be evaluated as literal while the variable dict for
# input_a is passed along.
class Query(ObjectType):
generic = GenericScalar(input_a=GenericScalar(), input_b=input_type())
def resolve_generic(self, info, input_a=None, input_b=None):
return input
> schema = Schema(query=Query)
graphene/tests/issues/test_1419.py:42:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_1419.py::test_parse_literal_with_variables[JSONString-"{\"key\":\"foo\",\"value\":\"bar\"}"]
test_1419.py::test_parse_literal_with_variables[JSONString-"{\\"key\\":\\"foo\\",\\"value\\":\\"bar\\"}"]
input_type = >
input_value = '"{\\"key\\":\\"foo\\",\\"value\\":\\"bar\\"}"'
@pytest.mark.parametrize(
"input_type,input_value",
[
(Date, '"2022-02-02"'),
(GenericScalar, '"foo"'),
(Int, "1"),
(BigInt, "12345678901234567890"),
(Float, "1.1"),
(String, '"foo"'),
(Boolean, "true"),
(ID, "1"),
(DateTime, '"2022-02-02T11:11:11"'),
(UUID, '"cbebbc62-758e-4f75-a890-bc73b5017d81"'),
(Decimal, '"1.1"'),
(JSONString, '"{\\"key\\":\\"foo\\",\\"value\\":\\"bar\\"}"'),
(Base64, '"Q2hlbG8gd29ycmxkCg=="'),
],
)
def test_parse_literal_with_variables(input_type, input_value):
# input_b needs to be evaluated as literal while the variable dict for
# input_a is passed along.
class Query(ObjectType):
generic = GenericScalar(input_a=GenericScalar(), input_b=input_type())
def resolve_generic(self, info, input_a=None, input_b=None):
return input
> schema = Schema(query=Query)
graphene/tests/issues/test_1419.py:42:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_1419.py::test_parse_literal_with_variables[Base64-"Q2hlbG8gd29ycmxkCg=="]
test_1419.py::test_parse_literal_with_variables[Base64-"Q2hlbG8gd29ycmxkCg=="]
input_type = >
input_value = '"Q2hlbG8gd29ycmxkCg=="'
@pytest.mark.parametrize(
"input_type,input_value",
[
(Date, '"2022-02-02"'),
(GenericScalar, '"foo"'),
(Int, "1"),
(BigInt, "12345678901234567890"),
(Float, "1.1"),
(String, '"foo"'),
(Boolean, "true"),
(ID, "1"),
(DateTime, '"2022-02-02T11:11:11"'),
(UUID, '"cbebbc62-758e-4f75-a890-bc73b5017d81"'),
(Decimal, '"1.1"'),
(JSONString, '"{\\"key\\":\\"foo\\",\\"value\\":\\"bar\\"}"'),
(Base64, '"Q2hlbG8gd29ycmxkCg=="'),
],
)
def test_parse_literal_with_variables(input_type, input_value):
# input_b needs to be evaluated as literal while the variable dict for
# input_a is passed along.
class Query(ObjectType):
generic = GenericScalar(input_a=GenericScalar(), input_b=input_type())
def resolve_generic(self, info, input_a=None, input_b=None):
return input
> schema = Schema(query=Query)
graphene/tests/issues/test_1419.py:42:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_313.py::test_create_post
test_313.py::test_create_post
def test_create_post():
query_string = """
mutation {
createPost(text: "Try this out") {
result {
__typename
}
}
}
"""
> schema = graphene.Schema(query=Query, mutation=Mutations)
graphene/tests/issues/test_313.py:53:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = >
subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_356.py::test_issue
test_356.py::test_issue
def test_issue():
class Query(graphene.ObjectType):
things = relay.ConnectionField(MyUnion)
with raises(Exception) as exc_info:
graphene.Schema(query=Query)
> assert str(exc_info.value) == (
"Query fields cannot be resolved."
" IterableConnectionField type has to be a subclass of Connection."
' Received "MyUnion".'
)
E assert "'TypeMap' ob...te 'add_type'" == 'Query fields...ed "MyUnion".'
E
E - Query fields cannot be resolved. IterableConnectionField type has to be a subclass of Connection. Received "MyUnion".
E + 'TypeMap' object has no attribute 'add_type'
graphene/tests/issues/test_356.py:29: AssertionError
test_490.py::test_issue
test_490.py::test_issue
def test_issue():
query_string = """
query myQuery {
someField(from: "Oh")
}
"""
> schema = graphene.Schema(query=Query)
graphene/tests/issues/test_490.py:20:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_720.py::test_issue
test_720.py::test_issue
def test_issue():
query_string = """
query myQuery {
myField(input: {x: 1})
}
"""
> schema = graphene.Schema(query=Query)
graphene/tests/issues/test_720.py:41:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_argument.py::test_argument
test_argument.py::test_argument
def test_argument():
arg = Argument(String, default_value="a", description="desc", name="b")
> assert arg.type == String
E AttributeError: 'Argument' object has no attribute 'type'
graphene/types/tests/test_argument.py:14: AttributeError
test_argument.py::test_argument_comparasion
test_argument.py::test_argument_comparasion
def test_argument_comparasion():
arg1 = Argument(
String,
name="Hey",
description="Desc",
default_value="default",
deprecation_reason="deprecated",
)
arg2 = Argument(
String,
name="Hey",
description="Desc",
default_value="default",
deprecation_reason="deprecated",
)
> assert arg1 == arg2
graphene/types/tests/test_argument.py:36:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
other =
def __eq__(self, other):
> return isinstance(other, Argument) and (self.name == other.name and self.type == other.type and (self.default_value == other.default_value) and (self.description == other.description) and (self.deprecation_reason == other.deprecation_reason))
E AttributeError: 'Argument' object has no attribute 'type'
graphene/types/argument.py:77: AttributeError
test_argument.py::test_argument_required
test_argument.py::test_argument_required
def test_argument_required():
arg = Argument(String, required=True)
> assert arg.type == NonNull(String)
E AttributeError: 'Argument' object has no attribute 'type'
graphene/types/tests/test_argument.py:42: AttributeError
test_argument.py::test_to_arguments
test_argument.py::test_to_arguments
def test_to_arguments():
args = {"arg_string": Argument(String), "unmounted_arg": String(required=True)}
my_args = to_arguments(args)
> assert my_args == {
"arg_string": Argument(String),
"unmounted_arg": Argument(String, required=True),
}
E AssertionError: assert [] == {'arg_string'...7fe41c721010>}
E
E Use -v to get more diff
graphene/types/tests/test_argument.py:49: AssertionError
test_argument.py::test_to_arguments_deprecated
test_argument.py::test_to_arguments_deprecated
def test_to_arguments_deprecated():
args = {"unmounted_arg": String(required=False, deprecation_reason="deprecated")}
my_args = to_arguments(args)
> assert my_args == {
"unmounted_arg": Argument(
String, required=False, deprecation_reason="deprecated"
),
}
E AssertionError: assert [] == {'unmounted_a...7fe41c55cc50>}
E
E Use -v to get more diff
graphene/types/tests/test_argument.py:59: AssertionError
test_argument.py::test_to_arguments_required_deprecated
test_argument.py::test_to_arguments_required_deprecated
def test_to_arguments_required_deprecated():
args = {
"unmounted_arg": String(
required=True, name="arg", deprecation_reason="deprecated"
)
}
> with raises(AssertionError) as exc_info:
E Failed: DID NOT RAISE
graphene/types/tests/test_argument.py:73: Failed
test_argument.py::test_to_arguments_raises_if_field
test_argument.py::test_to_arguments_raises_if_field
def test_to_arguments_raises_if_field():
args = {"arg_string": Field(String)}
with raises(ValueError) as exc_info:
to_arguments(args)
> assert str(exc_info.value) == (
"Expected arg_string to be Argument, but received Field. Try using "
"Argument(String)."
)
E assert "Unknown argu...field.Field'>" == 'Expected arg...ment(String).'
E
E - Expected arg_string to be Argument, but received Field. Try using Argument(String).
E + Unknown argument "arg_string" of type
graphene/types/tests/test_argument.py:85: AssertionError
test_argument.py::test_to_arguments_raises_if_inputfield
def test_to_arguments_raises_if_inputfield():
args = {"arg_string": InputField(String)}
with raises(ValueError) as exc_info:
to_arguments(args)
> assert str(exc_info.value) == (
"Expected arg_string to be Argument, but received InputField. Try "
"using Argument(String)."
)
E assert "Unknown argu....InputField'>" == 'Expected arg...ment(String).'
E
E - Expected arg_string to be Argument, but received InputField. Try using Argument(String).
E + Unknown argument "arg_string" of type
graphene/types/tests/test_argument.py:97: AssertionError
test_argument.py::test_argument_with_lazy_type
test_argument.py::test_argument_with_lazy_type
def test_argument_with_lazy_type():
MyType = object()
arg = Argument(lambda: MyType)
> assert arg.type == MyType
E AttributeError: 'Argument' object has no attribute 'type'
graphene/types/tests/test_argument.py:106: AttributeError
test_argument.py::test_argument_with_lazy_partial_type
test_argument.py::test_argument_with_lazy_partial_type
def test_argument_with_lazy_partial_type():
MyType = object()
arg = Argument(partial(lambda: MyType))
> assert arg.type == MyType
E AttributeError: 'Argument' object has no attribute 'type'
graphene/types/tests/test_argument.py:112: AttributeError
test_base.py::test_basetype_create
test_base.py::test_basetype_create
def test_basetype_create():
> MyBaseType = CustomType.create_type("MyBaseType")
E AttributeError: type object 'CustomType' has no attribute 'create_type'
graphene/types/tests/test_base.py:51: AttributeError
test_base.py::test_basetype_create_extra
def test_basetype_create_extra():
> MyBaseType = CustomType.create_type("MyBaseType", name="Base", description="Desc")
E AttributeError: type object 'CustomType' has no attribute 'create_type'
graphene/types/tests/test_base.py:59: AttributeError
test_definition.py::test_defines_a_query_only_schema
test_definition.py::test_defines_a_query_only_schema
def test_defines_a_query_only_schema():
> blog_schema = Schema(Query)
graphene/types/tests/test_definition.py:73:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_definition.py::test_defines_a_mutation_schema
test_definition.py::test_defines_a_mutation_schema
def test_defines_a_mutation_schema():
> blog_schema = Schema(Query, mutation=Mutation)
graphene/types/tests/test_definition.py:100:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = >
subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_definition.py::test_defines_a_subscription_schema
test_definition.py::test_defines_a_subscription_schema
def test_defines_a_subscription_schema():
> blog_schema = Schema(Query, subscription=Subscription)
graphene/types/tests/test_definition.py:111:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None
subscription = >
types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_definition.py::test_includes_nested_input_objects_in_the_map
def test_includes_nested_input_objects_in_the_map():
class NestedInputObject(InputObjectType):
value = String()
class SomeInputObject(InputObjectType):
nested = InputField(NestedInputObject)
class SomeMutation(Mutation):
mutate_something = Field(Article, input=Argument(SomeInputObject))
class SomeSubscription(Mutation):
subscribe_to_something = Field(Article, input=Argument(SomeInputObject))
> schema = Schema(query=Query, mutation=SomeMutation, subscription=SomeSubscription)
graphene/types/tests/test_definition.py:134:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = >
subscription = >
types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_definition.py::test_includes_interfaces_thunk_subtypes_in_the_type_map
test_definition.py::test_includes_interfaces_thunk_subtypes_in_the_type_map
def test_includes_interfaces_thunk_subtypes_in_the_type_map():
class SomeInterface(Interface):
f = Int()
class SomeSubtype(ObjectType):
class Meta:
interfaces = (SomeInterface,)
class Query(ObjectType):
iface = Field(lambda: SomeInterface)
> schema = Schema(query=Query, types=[SomeSubtype])
graphene/types/tests/test_definition.py:151:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None
types = [>]
auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_definition.py::test_includes_types_in_union
test_definition.py::test_includes_types_in_union
def test_includes_types_in_union():
class SomeType(ObjectType):
a = String()
class OtherType(ObjectType):
b = String()
class MyUnion(Union):
class Meta:
types = (SomeType, OtherType)
class Query(ObjectType):
union = Field(MyUnion)
> schema = Schema(query=Query)
graphene/types/tests/test_definition.py:171:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_definition.py::test_maps_enum
test_definition.py::test_maps_enum
def test_maps_enum():
class SomeType(ObjectType):
a = String()
class OtherType(ObjectType):
b = String()
class MyUnion(Union):
class Meta:
types = (SomeType, OtherType)
class Query(ObjectType):
union = Field(MyUnion)
> schema = Schema(query=Query)
graphene/types/tests/test_definition.py:192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_definition.py::test_includes_interfaces_subtypes_in_the_type_map
test_definition.py::test_includes_interfaces_subtypes_in_the_type_map
def test_includes_interfaces_subtypes_in_the_type_map():
class SomeInterface(Interface):
f = Int()
class SomeSubtype(ObjectType):
class Meta:
interfaces = (SomeInterface,)
class Query(ObjectType):
iface = Field(SomeInterface)
> schema = Schema(query=Query, types=[SomeSubtype])
graphene/types/tests/test_definition.py:210:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None
types = [>]
auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_definition.py::test_stringifies_simple_types
test_definition.py::test_stringifies_simple_types
def test_stringifies_simple_types():
assert str(Int) == "Int"
assert str(Article) == "Article"
assert str(MyInterface) == "MyInterface"
assert str(MyUnion) == "MyUnion"
assert str(MyEnum) == "MyEnum"
assert str(MyInputObjectType) == "MyInputObjectType"
> assert str(NonNull(Int)) == "Int!"
graphene/types/tests/test_definition.py:223:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
def __str__(self):
> return f'{self.of_type}!'
E AttributeError: 'NonNull' object has no attribute 'of_type'
graphene/types/structures.py:81: AttributeError
test_definition.py::test_does_not_mutate_passed_field_definitions
test_definition.py::test_does_not_mutate_passed_field_definitions
def test_does_not_mutate_passed_field_definitions():
class CommonFields:
field1 = String()
field2 = String(id=String())
class TestObject1(CommonFields, ObjectType):
pass
class TestObject2(CommonFields, ObjectType):
pass
> assert TestObject1._meta.fields == TestObject2._meta.fields
E AssertionError: assert {'field1': } == {'field1': }
E
E Differing items:
E {'field1': } != {'field1': }
E {'field2': } != {'field2': }
E Use -v to get more diff
graphene/types/tests/test_definition.py:305: AssertionError
test_definition.py::test_graphene_graphql_type_can_be_copied
test_definition.py::test_graphene_graphql_type_can_be_copied
def test_graphene_graphql_type_can_be_copied():
class Query(ObjectType):
field = String()
def resolve_field(self, info):
return ""
> schema = Schema(query=Query)
graphene/types/tests/test_definition.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_dynamic.py::test_dynamic
test_dynamic.py::test_dynamic
def test_dynamic():
dynamic = Dynamic(lambda: String)
> assert dynamic.get_type() == String
E AttributeError: 'Dynamic' object has no attribute 'get_type'
graphene/types/tests/test_dynamic.py:10: AttributeError
test_dynamic.py::test_nonnull
test_dynamic.py::test_nonnull
def test_nonnull():
dynamic = Dynamic(lambda: NonNull(String))
> assert dynamic.get_type().of_type == String
E AttributeError: 'Dynamic' object has no attribute 'get_type'
graphene/types/tests/test_dynamic.py:16: AttributeError
test_dynamic.py::test_list
test_dynamic.py::test_list
def test_list():
dynamic = Dynamic(lambda: List(String))
> assert dynamic.get_type().of_type == String
E AttributeError: 'Dynamic' object has no attribute 'get_type'
graphene/types/tests/test_dynamic.py:22: AttributeError
test_dynamic.py::test_list_non_null
test_dynamic.py::test_list_non_null
def test_list_non_null():
dynamic = Dynamic(lambda: List(NonNull(String)))
> assert dynamic.get_type().of_type.of_type == String
E AttributeError: 'Dynamic' object has no attribute 'get_type'
graphene/types/tests/test_dynamic.py:28: AttributeError
test_dynamic.py::test_partial
test_dynamic.py::test_partial
def test_partial():
def __type(_type):
return _type
dynamic = Dynamic(partial(__type, String))
> assert dynamic.get_type() == String
E AttributeError: 'Dynamic' object has no attribute 'get_type'
graphene/types/tests/test_dynamic.py:37: AttributeError
test_enum.py::test_enum_from_python3_enum_uses_default_builtin_doc
test_enum.py::test_enum_from_python3_enum_uses_default_builtin_doc
def test_enum_from_python3_enum_uses_default_builtin_doc():
RGB = Enum("RGB", "RED,GREEN,BLUE")
> assert RGB._meta.description == "An enumeration."
E AssertionError: assert None == 'An enumeration.'
E + where None = .description
E + where = >._meta
graphene/types/tests/test_enum.py:80: AssertionError
test_enum.py::test_enum_from_builtin_enum_accepts_lambda_description
test_enum.py::test_enum_from_builtin_enum_accepts_lambda_description
def test_enum_from_builtin_enum_accepts_lambda_description():
def custom_description(value):
if not value:
return "StarWars Episodes"
return "New Hope Episode" if value == Episode.NEWHOPE else "Other"
def custom_deprecation_reason(value):
return "meh" if value == Episode.NEWHOPE else None
PyEpisode = PyEnum("PyEpisode", "NEWHOPE,EMPIRE,JEDI")
Episode = Enum.from_enum(
PyEpisode,
description=custom_description,
deprecation_reason=custom_deprecation_reason,
)
> class Query(ObjectType):
graphene/types/tests/test_enum.py:100:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/objecttype.py:23: in __new__
base_cls = super().__new__(cls, name_, (InterObjectType,) + bases, namespace, **options)
graphene/utils/subclass_with_meta.py:37: in __init_subclass__
super_class.__init_subclass_with_meta__(**options)
graphene/types/objecttype.py:113: in __init_subclass_with_meta__
fields.update(yank_fields_from_attrs(base.__dict__, _as=Field))
graphene/types/utils.py:43: in yank_fields_from_attrs
fields.append((key, get_field_as(value, _as)))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value =
_as =
def get_field_as(value, _as=None):
"""
Get type mounted
"""
if isinstance(value, MountedType):
return value
elif isinstance(value, UnmountedType):
> return value.mount(_as)
E AttributeError: 'PyEpisode' object has no attribute 'mount'
graphene/types/utils.py:32: AttributeError
test_enum.py::test_enum_from_python3_enum_uses_enum_doc
test_enum.py::test_enum_from_python3_enum_uses_enum_doc
def test_enum_from_python3_enum_uses_enum_doc():
from enum import Enum as PyEnum
class Color(PyEnum):
"""This is the description"""
RED = 1
GREEN = 2
BLUE = 3
RGB = Enum.from_enum(Color)
assert RGB._meta.enum == Color
> assert RGB._meta.description == "This is the description"
E AssertionError: assert None == 'This is the description'
E + where None = .description
E + where = >._meta
graphene/types/tests/test_enum.py:130: AssertionError
test_enum.py::test_enum_value_as_unmounted_field
test_enum.py::test_enum_value_as_unmounted_field
def test_enum_value_as_unmounted_field():
class RGB(Enum):
RED = 1
GREEN = 2
BLUE = 3
unmounted = RGB()
unmounted_field = unmounted.Field()
> assert isinstance(unmounted_field, Field)
E assert False
E + where False = isinstance(None, Field)
graphene/types/tests/test_enum.py:156: AssertionError
test_enum.py::test_enum_value_as_unmounted_inputfield
def test_enum_value_as_unmounted_inputfield():
class RGB(Enum):
RED = 1
GREEN = 2
BLUE = 3
unmounted = RGB()
unmounted_field = unmounted.InputField()
> assert isinstance(unmounted_field, InputField)
E assert False
E + where False = isinstance(None, InputField)
graphene/types/tests/test_enum.py:168: AssertionError
test_enum.py::test_enum_value_as_unmounted_argument
test_enum.py::test_enum_value_as_unmounted_argument
def test_enum_value_as_unmounted_argument():
class RGB(Enum):
RED = 1
GREEN = 2
BLUE = 3
unmounted = RGB()
unmounted_field = unmounted.Argument()
> assert isinstance(unmounted_field, Argument)
E assert False
E + where False = isinstance(None, Argument)
graphene/types/tests/test_enum.py:180: AssertionError
test_enum.py::test_enum_can_be_initialized
test_enum.py::test_enum_can_be_initialized
def test_enum_can_be_initialized():
class RGB(Enum):
RED = 1
GREEN = 2
BLUE = 3
> assert RGB.get(1) == RGB.RED
E AttributeError: type object 'RGB' has no attribute 'get'
graphene/types/tests/test_enum.py:201: AttributeError
test_enum.py::test_enum_to_enum_comparison_should_differ
test_enum.py::test_enum_to_enum_comparison_should_differ
def test_enum_to_enum_comparison_should_differ():
class RGB1(Enum):
RED = 1
GREEN = 2
BLUE = 3
class RGB2(Enum):
RED = 1
GREEN = 2
BLUE = 3
> assert RGB1.RED != RGB2.RED
E AssertionError: assert !=
E + where = >.RED
E + and = >.RED
graphene/types/tests/test_enum.py:228: AssertionError
test_enum.py::test_enum_types
test_enum.py::test_enum_types
def test_enum_types():
from enum import Enum as PyEnum
class Color(PyEnum):
"""Primary colors"""
RED = 1
YELLOW = 2
BLUE = 3
GColor = Enum.from_enum(Color)
> class Query(ObjectType):
graphene/types/tests/test_enum.py:261:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/objecttype.py:23: in __new__
base_cls = super().__new__(cls, name_, (InterObjectType,) + bases, namespace, **options)
graphene/utils/subclass_with_meta.py:37: in __init_subclass__
super_class.__init_subclass_with_meta__(**options)
graphene/types/objecttype.py:113: in __init_subclass_with_meta__
fields.update(yank_fields_from_attrs(base.__dict__, _as=Field))
graphene/types/utils.py:43: in yank_fields_from_attrs
fields.append((key, get_field_as(value, _as)))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value =
_as =
def get_field_as(value, _as=None):
"""
Get type mounted
"""
if isinstance(value, MountedType):
return value
elif isinstance(value, UnmountedType):
> return value.mount(_as)
E AttributeError: 'Color' object has no attribute 'mount'
graphene/types/utils.py:32: AttributeError
test_enum.py::test_enum_resolver
test_enum.py::test_enum_resolver
def test_enum_resolver():
from enum import Enum as PyEnum
class Color(PyEnum):
RED = 1
GREEN = 2
BLUE = 3
GColor = Enum.from_enum(Color)
> class Query(ObjectType):
graphene/types/tests/test_enum.py:298:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/objecttype.py:23: in __new__
base_cls = super().__new__(cls, name_, (InterObjectType,) + bases, namespace, **options)
graphene/utils/subclass_with_meta.py:37: in __init_subclass__
super_class.__init_subclass_with_meta__(**options)
graphene/types/objecttype.py:113: in __init_subclass_with_meta__
fields.update(yank_fields_from_attrs(base.__dict__, _as=Field))
graphene/types/utils.py:43: in yank_fields_from_attrs
fields.append((key, get_field_as(value, _as)))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value =
_as =
def get_field_as(value, _as=None):
"""
Get type mounted
"""
if isinstance(value, MountedType):
return value
elif isinstance(value, UnmountedType):
> return value.mount(_as)
E AttributeError: 'Color' object has no attribute 'mount'
graphene/types/utils.py:32: AttributeError
test_enum.py::test_enum_resolver_compat
test_enum.py::test_enum_resolver_compat
def test_enum_resolver_compat():
from enum import Enum as PyEnum
class Color(PyEnum):
RED = 1
GREEN = 2
BLUE = 3
GColor = Enum.from_enum(Color)
> class Query(ObjectType):
graphene/types/tests/test_enum.py:322:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/objecttype.py:23: in __new__
base_cls = super().__new__(cls, name_, (InterObjectType,) + bases, namespace, **options)
graphene/utils/subclass_with_meta.py:37: in __init_subclass__
super_class.__init_subclass_with_meta__(**options)
graphene/types/objecttype.py:113: in __init_subclass_with_meta__
fields.update(yank_fields_from_attrs(base.__dict__, _as=Field))
graphene/types/utils.py:43: in yank_fields_from_attrs
fields.append((key, get_field_as(value, _as)))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value =
_as =
def get_field_as(value, _as=None):
"""
Get type mounted
"""
if isinstance(value, MountedType):
return value
elif isinstance(value, UnmountedType):
> return value.mount(_as)
E AttributeError: 'Color' object has no attribute 'mount'
graphene/types/utils.py:32: AttributeError
test_enum.py::test_enum_with_name
test_enum.py::test_enum_with_name
def test_enum_with_name():
from enum import Enum as PyEnum
class Color(PyEnum):
RED = 1
YELLOW = 2
BLUE = 3
GColor = Enum.from_enum(Color, description="original colors")
> UniqueGColor = Enum.from_enum(
Color, name="UniqueColor", description="unique colors"
)
E TypeError: Enum.from_enum() got an unexpected keyword argument 'name'
graphene/types/tests/test_enum.py:355: TypeError
test_enum.py::test_enum_resolver_invalid
test_enum.py::test_enum_resolver_invalid
def test_enum_resolver_invalid():
from enum import Enum as PyEnum
class Color(PyEnum):
RED = 1
GREEN = 2
BLUE = 3
GColor = Enum.from_enum(Color)
> class Query(ObjectType):
graphene/types/tests/test_enum.py:402:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/objecttype.py:23: in __new__
base_cls = super().__new__(cls, name_, (InterObjectType,) + bases, namespace, **options)
graphene/utils/subclass_with_meta.py:37: in __init_subclass__
super_class.__init_subclass_with_meta__(**options)
graphene/types/objecttype.py:113: in __init_subclass_with_meta__
fields.update(yank_fields_from_attrs(base.__dict__, _as=Field))
graphene/types/utils.py:43: in yank_fields_from_attrs
fields.append((key, get_field_as(value, _as)))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value =
_as =
def get_field_as(value, _as=None):
"""
Get type mounted
"""
if isinstance(value, MountedType):
return value
elif isinstance(value, UnmountedType):
> return value.mount(_as)
E AttributeError: 'Color' object has no attribute 'mount'
graphene/types/utils.py:32: AttributeError
test_enum.py::test_field_enum_argument
test_enum.py::test_field_enum_argument
def test_field_enum_argument():
class Color(Enum):
RED = 1
GREEN = 2
BLUE = 3
> class Brick(ObjectType):
graphene/types/tests/test_enum.py:421:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/objecttype.py:23: in __new__
base_cls = super().__new__(cls, name_, (InterObjectType,) + bases, namespace, **options)
graphene/utils/subclass_with_meta.py:37: in __init_subclass__
super_class.__init_subclass_with_meta__(**options)
graphene/types/objecttype.py:113: in __init_subclass_with_meta__
fields.update(yank_fields_from_attrs(base.__dict__, _as=Field))
graphene/types/utils.py:43: in yank_fields_from_attrs
fields.append((key, get_field_as(value, _as)))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value = .Color object at 0x7fe41c6483d0>
_as =
def get_field_as(value, _as=None):
"""
Get type mounted
"""
if isinstance(value, MountedType):
return value
elif isinstance(value, UnmountedType):
> return value.mount(_as)
E AttributeError: 'Color' object has no attribute 'mount'
graphene/types/utils.py:32: AttributeError
test_enum.py::test_mutation_enum_input
def test_mutation_enum_input():
class RGB(Enum):
"""Available colors"""
RED = 1
GREEN = 2
BLUE = 3
color_input = None
> class CreatePaint(Mutation):
graphene/types/tests/test_enum.py:460:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/objecttype.py:23: in __new__
base_cls = super().__new__(cls, name_, (InterObjectType,) + bases, namespace, **options)
graphene/utils/subclass_with_meta.py:37: in __init_subclass__
super_class.__init_subclass_with_meta__(**options)
graphene/types/mutation.py:75: in __init_subclass_with_meta__
fields.update(yank_fields_from_attrs(base.__dict__, _as=Field))
graphene/types/utils.py:43: in yank_fields_from_attrs
fields.append((key, get_field_as(value, _as)))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value = .RGB object at 0x7fe41c4dd450>
_as =
def get_field_as(value, _as=None):
"""
Get type mounted
"""
if isinstance(value, MountedType):
return value
elif isinstance(value, UnmountedType):
> return value.mount(_as)
E AttributeError: 'RGB' object has no attribute 'mount'
graphene/types/utils.py:32: AttributeError
test_enum.py::test_mutation_enum_input_type
def test_mutation_enum_input_type():
class RGB(Enum):
"""Available colors"""
RED = 1
GREEN = 2
BLUE = 3
> class ColorInput(InputObjectType):
graphene/types/tests/test_enum.py:500:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/subclass_with_meta.py:37: in __init_subclass__
super_class.__init_subclass_with_meta__(**options)
graphene/types/inputobjecttype.py:80: in __init_subclass_with_meta__
fields.update(yank_fields_from_attrs(base.__dict__, _as=InputField))
graphene/types/utils.py:43: in yank_fields_from_attrs
fields.append((key, get_field_as(value, _as)))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value = .RGB object at 0x7fe41c4079d0>
_as =
def get_field_as(value, _as=None):
"""
Get type mounted
"""
if isinstance(value, MountedType):
return value
elif isinstance(value, UnmountedType):
> return value.mount(_as)
E AttributeError: 'RGB' object has no attribute 'mount'
graphene/types/utils.py:32: AttributeError
test_enum.py::test_hashable_enum
test_enum.py::test_hashable_enum
def test_hashable_enum():
class RGB(Enum):
"""Available colors"""
RED = 1
GREEN = 2
BLUE = 3
color_map = {RGB.RED: "a", RGB.BLUE: "b", 1: "c"}
> assert color_map[RGB.RED] == "a"
E AssertionError: assert 'c' == 'a'
E
E - a
E + c
graphene/types/tests/test_enum.py:548: AssertionError
test_enum.py::test_enum_description_member_not_interpreted_as_property
test_enum.py::test_enum_description_member_not_interpreted_as_property
def test_enum_description_member_not_interpreted_as_property():
class RGB(Enum):
"""Description"""
red = "red"
green = "green"
blue = "blue"
description = "description"
deprecation_reason = "deprecation_reason"
> class Query(ObjectType):
graphene/types/tests/test_enum.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/objecttype.py:23: in __new__
base_cls = super().__new__(cls, name_, (InterObjectType,) + bases, namespace, **options)
graphene/utils/subclass_with_meta.py:37: in __init_subclass__
super_class.__init_subclass_with_meta__(**options)
graphene/types/objecttype.py:113: in __init_subclass_with_meta__
fields.update(yank_fields_from_attrs(base.__dict__, _as=Field))
graphene/types/utils.py:43: in yank_fields_from_attrs
fields.append((key, get_field_as(value, _as)))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value = .RGB object at 0x7fe41c77c350>
_as =
def get_field_as(value, _as=None):
"""
Get type mounted
"""
if isinstance(value, MountedType):
return value
elif isinstance(value, UnmountedType):
> return value.mount(_as)
E AttributeError: 'RGB' object has no attribute 'mount'
graphene/types/utils.py:32: AttributeError
test_field.py::test_field_basic
test_field.py::test_field_basic
def test_field_basic():
MyType = object()
args = {"my arg": Argument(True)}
def resolver():
return None
deprecation_reason = "Deprecated now"
description = "My Field"
my_default = "something"
field = Field(
MyType,
name="name",
args=args,
resolver=resolver,
description=description,
deprecation_reason=deprecation_reason,
default_value=my_default,
)
assert field.name == "name"
> assert field.args == args
E AssertionError: assert [] == {'my arg': }
E
E Use -v to get more diff
graphene/types/tests/test_field.py:40: AssertionError
test_field.py::test_field_required
test_field.py::test_field_required
def test_field_required():
MyType = object()
field = Field(MyType, required=True)
> assert isinstance(field.type, NonNull)
E AttributeError: 'Field' object has no attribute 'type'
graphene/types/tests/test_field.py:50: AttributeError
test_field.py::test_field_source
test_field.py::test_field_source
def test_field_source():
MyType = object()
> field = Field(MyType, source="value")
graphene/types/tests/test_field.py:65:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
type_ = , args = None, resolver = None
source = 'value', deprecation_reason = None, name = None, description = None
required = False, _creation_counter = None, default_value = None
extra_args = {}
def __init__(self, type_, args=None, resolver=None, source=None, deprecation_reason=None, name=None, description=None, required=False, _creation_counter=None, default_value=None, **extra_args):
super(Field, self).__init__(_creation_counter=_creation_counter)
assert not args or isinstance(args, Mapping), f'Arguments in a field have to be a mapping, received "{args}".'
assert not (source and resolver), 'A Field cannot have a source and a resolver in at the same time.'
assert not callable(default_value), f'The default value can not be a function but received "{base_type(default_value)}".'
if required:
type_ = NonNull(type_)
if isinstance(name, (Argument, UnmountedType)):
extra_args['name'] = name
name = None
if isinstance(source, (Argument, UnmountedType)):
extra_args['source'] = source
source = None
self.name = name
self._type = type_
self.args = to_arguments(args or {}, extra_args)
if source:
> resolver = partial(source_resolver, source)
E NameError: name 'source_resolver' is not defined
graphene/types/field.py:73: NameError
test_field.py::test_field_source_dict_or_attr
test_field.py::test_field_source_dict_or_attr
def test_field_source_dict_or_attr():
MyType = object()
> field = Field(MyType, source="value")
graphene/types/tests/test_field.py:71:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
type_ = , args = None, resolver = None
source = 'value', deprecation_reason = None, name = None, description = None
required = False, _creation_counter = None, default_value = None
extra_args = {}
def __init__(self, type_, args=None, resolver=None, source=None, deprecation_reason=None, name=None, description=None, required=False, _creation_counter=None, default_value=None, **extra_args):
super(Field, self).__init__(_creation_counter=_creation_counter)
assert not args or isinstance(args, Mapping), f'Arguments in a field have to be a mapping, received "{args}".'
assert not (source and resolver), 'A Field cannot have a source and a resolver in at the same time.'
assert not callable(default_value), f'The default value can not be a function but received "{base_type(default_value)}".'
if required:
type_ = NonNull(type_)
if isinstance(name, (Argument, UnmountedType)):
extra_args['name'] = name
name = None
if isinstance(source, (Argument, UnmountedType)):
extra_args['source'] = source
source = None
self.name = name
self._type = type_
self.args = to_arguments(args or {}, extra_args)
if source:
> resolver = partial(source_resolver, source)
E NameError: name 'source_resolver' is not defined
graphene/types/field.py:73: NameError
test_field.py::test_field_with_lazy_type
test_field.py::test_field_with_lazy_type
def test_field_with_lazy_type():
MyType = object()
field = Field(lambda: MyType)
> assert field.type == MyType
E AttributeError: 'Field' object has no attribute 'type'
graphene/types/tests/test_field.py:79: AttributeError
test_field.py::test_field_with_lazy_partial_type
test_field.py::test_field_with_lazy_partial_type
def test_field_with_lazy_partial_type():
MyType = object()
field = Field(partial(lambda: MyType))
> assert field.type == MyType
E AttributeError: 'Field' object has no attribute 'type'
graphene/types/tests/test_field.py:85: AttributeError
test_field.py::test_field_with_string_type
test_field.py::test_field_with_string_type
def test_field_with_string_type():
field = Field("graphene.types.tests.utils.MyLazyType")
> assert field.type == MyLazyType
E AttributeError: 'Field' object has no attribute 'type'
graphene/types/tests/test_field.py:90: AttributeError
test_field.py::test_field_source_func
test_field.py::test_field_source_func
def test_field_source_func():
MyType = object()
> field = Field(MyType, source="value_func")
graphene/types/tests/test_field.py:105:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
type_ = , args = None, resolver = None
source = 'value_func', deprecation_reason = None, name = None
description = None, required = False, _creation_counter = None
default_value = None, extra_args = {}
def __init__(self, type_, args=None, resolver=None, source=None, deprecation_reason=None, name=None, description=None, required=False, _creation_counter=None, default_value=None, **extra_args):
super(Field, self).__init__(_creation_counter=_creation_counter)
assert not args or isinstance(args, Mapping), f'Arguments in a field have to be a mapping, received "{args}".'
assert not (source and resolver), 'A Field cannot have a source and a resolver in at the same time.'
assert not callable(default_value), f'The default value can not be a function but received "{base_type(default_value)}".'
if required:
type_ = NonNull(type_)
if isinstance(name, (Argument, UnmountedType)):
extra_args['name'] = name
name = None
if isinstance(source, (Argument, UnmountedType)):
extra_args['source'] = source
source = None
self.name = name
self._type = type_
self.args = to_arguments(args or {}, extra_args)
if source:
> resolver = partial(source_resolver, source)
E NameError: name 'source_resolver' is not defined
graphene/types/field.py:73: NameError
test_field.py::test_field_source_method
test_field.py::test_field_source_method
def test_field_source_method():
MyType = object()
> field = Field(MyType, source="value_method")
graphene/types/tests/test_field.py:111:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
type_ = , args = None, resolver = None
source = 'value_method', deprecation_reason = None, name = None
description = None, required = False, _creation_counter = None
default_value = None, extra_args = {}
def __init__(self, type_, args=None, resolver=None, source=None, deprecation_reason=None, name=None, description=None, required=False, _creation_counter=None, default_value=None, **extra_args):
super(Field, self).__init__(_creation_counter=_creation_counter)
assert not args or isinstance(args, Mapping), f'Arguments in a field have to be a mapping, received "{args}".'
assert not (source and resolver), 'A Field cannot have a source and a resolver in at the same time.'
assert not callable(default_value), f'The default value can not be a function but received "{base_type(default_value)}".'
if required:
type_ = NonNull(type_)
if isinstance(name, (Argument, UnmountedType)):
extra_args['name'] = name
name = None
if isinstance(source, (Argument, UnmountedType)):
extra_args['source'] = source
source = None
self.name = name
self._type = type_
self.args = to_arguments(args or {}, extra_args)
if source:
> resolver = partial(source_resolver, source)
E NameError: name 'source_resolver' is not defined
graphene/types/field.py:73: NameError
test_field.py::test_field_source_as_argument
test_field.py::test_field_source_as_argument
def test_field_source_as_argument():
MyType = object()
field = Field(MyType, source=String())
> assert "source" in field.args
E AssertionError: assert 'source' in []
E + where [] = .args
graphene/types/tests/test_field.py:118: AssertionError
test_field.py::test_field_name_as_argument
test_field.py::test_field_name_as_argument
def test_field_name_as_argument():
MyType = object()
field = Field(MyType, name=String())
> assert "name" in field.args
E AssertionError: assert 'name' in []
E + where [] = .args
graphene/types/tests/test_field.py:125: AssertionError
test_field.py::test_field_source_argument_as_kw
test_field.py::test_field_source_argument_as_kw
def test_field_source_argument_as_kw():
MyType = object()
deprecation_reason = "deprecated"
field = Field(
MyType,
b=NonNull(True),
c=Argument(None, deprecation_reason=deprecation_reason),
a=NonNull(False),
)
> assert list(field.args) == ["b", "c", "a"]
E AssertionError: assert [] == ['b', 'c', 'a']
E
E At index 0 diff: != 'b'
E Use -v to get more diff
graphene/types/tests/test_field.py:138: AssertionError
test_inputfield.py::test_inputfield_required
def test_inputfield_required():
MyType = object()
field = InputField(MyType, required=True)
> assert isinstance(field.type, NonNull)
E AttributeError: 'InputField' object has no attribute 'type'
graphene/types/tests/test_inputfield.py:13: AttributeError
test_inputfield.py::test_inputfield_deprecated
def test_inputfield_deprecated():
MyType = object()
deprecation_reason = "deprecated"
field = InputField(MyType, required=False, deprecation_reason=deprecation_reason)
> assert isinstance(field.type, type(MyType))
E AttributeError: 'InputField' object has no attribute 'type'
graphene/types/tests/test_inputfield.py:21: AttributeError
test_inputfield.py::test_inputfield_with_lazy_type
def test_inputfield_with_lazy_type():
MyType = object()
field = InputField(lambda: MyType)
> assert field.type == MyType
E AttributeError: 'InputField' object has no attribute 'type'
graphene/types/tests/test_inputfield.py:36: AttributeError
test_inputfield.py::test_inputfield_with_lazy_partial_type
def test_inputfield_with_lazy_partial_type():
MyType = object()
field = InputField(partial(lambda: MyType))
> assert field.type == MyType
E AttributeError: 'InputField' object has no attribute 'type'
graphene/types/tests/test_inputfield.py:42: AttributeError
test_inputfield.py::test_inputfield_with_string_type
def test_inputfield_with_string_type():
field = InputField("graphene.types.tests.utils.MyLazyType")
> assert field.type == MyLazyType
E AttributeError: 'InputField' object has no attribute 'type'
graphene/types/tests/test_inputfield.py:47: AttributeError
test_inputobjecttype.py::test_ordered_fields_in_inputobjecttype
def test_ordered_fields_in_inputobjecttype():
> class MyInputObjectType(InputObjectType):
graphene/types/tests/test_inputobjecttype.py:50:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/subclass_with_meta.py:37: in __init_subclass__
super_class.__init_subclass_with_meta__(**options)
graphene/types/inputobjecttype.py:80: in __init_subclass_with_meta__
fields.update(yank_fields_from_attrs(base.__dict__, _as=InputField))
graphene/types/utils.py:43: in yank_fields_from_attrs
fields.append((key, get_field_as(value, _as)))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value =
_as =
def get_field_as(value, _as=None):
"""
Get type mounted
"""
if isinstance(value, MountedType):
return value
elif isinstance(value, UnmountedType):
> return value.mount(_as)
E AttributeError: 'MyScalar' object has no attribute 'mount'
graphene/types/utils.py:32: AttributeError
test_inputobjecttype.py::test_generate_inputobjecttype_unmountedtype
def test_generate_inputobjecttype_unmountedtype():
> class MyInputObjectType(InputObjectType):
graphene/types/tests/test_inputobjecttype.py:60:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/subclass_with_meta.py:37: in __init_subclass__
super_class.__init_subclass_with_meta__(**options)
graphene/types/inputobjecttype.py:80: in __init_subclass_with_meta__
fields.update(yank_fields_from_attrs(base.__dict__, _as=InputField))
graphene/types/utils.py:43: in yank_fields_from_attrs
fields.append((key, get_field_as(value, _as)))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value =
_as =
def get_field_as(value, _as=None):
"""
Get type mounted
"""
if isinstance(value, MountedType):
return value
elif isinstance(value, UnmountedType):
> return value.mount(_as)
E AttributeError: 'MyScalar' object has no attribute 'mount'
graphene/types/utils.py:32: AttributeError
test_inputobjecttype.py::test_generate_inputobjecttype_as_argument
def test_generate_inputobjecttype_as_argument():
> class MyInputObjectType(InputObjectType):
graphene/types/tests/test_inputobjecttype.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/subclass_with_meta.py:37: in __init_subclass__
super_class.__init_subclass_with_meta__(**options)
graphene/types/inputobjecttype.py:80: in __init_subclass_with_meta__
fields.update(yank_fields_from_attrs(base.__dict__, _as=InputField))
graphene/types/utils.py:43: in yank_fields_from_attrs
fields.append((key, get_field_as(value, _as)))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value =
_as =
def get_field_as(value, _as=None):
"""
Get type mounted
"""
if isinstance(value, MountedType):
return value
elif isinstance(value, UnmountedType):
> return value.mount(_as)
E AttributeError: 'MyScalar' object has no attribute 'mount'
graphene/types/utils.py:32: AttributeError
test_inputobjecttype.py::test_generate_inputobjecttype_inherit_abstracttype
def test_generate_inputobjecttype_inherit_abstracttype():
class MyAbstractType:
field1 = MyScalar(MyType)
> class MyInputObjectType(InputObjectType, MyAbstractType):
graphene/types/tests/test_inputobjecttype.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/subclass_with_meta.py:37: in __init_subclass__
super_class.__init_subclass_with_meta__(**options)
graphene/types/inputobjecttype.py:80: in __init_subclass_with_meta__
fields.update(yank_fields_from_attrs(base.__dict__, _as=InputField))
graphene/types/utils.py:43: in yank_fields_from_attrs
fields.append((key, get_field_as(value, _as)))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value =
_as =
def get_field_as(value, _as=None):
"""
Get type mounted
"""
if isinstance(value, MountedType):
return value
elif isinstance(value, UnmountedType):
> return value.mount(_as)
E AttributeError: 'MyScalar' object has no attribute 'mount'
graphene/types/utils.py:32: AttributeError
test_inputobjecttype.py::test_generate_inputobjecttype_inherit_abstracttype_reversed
def test_generate_inputobjecttype_inherit_abstracttype_reversed():
class MyAbstractType:
field1 = MyScalar(MyType)
> class MyInputObjectType(MyAbstractType, InputObjectType):
graphene/types/tests/test_inputobjecttype.py:101:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/subclass_with_meta.py:37: in __init_subclass__
super_class.__init_subclass_with_meta__(**options)
graphene/types/inputobjecttype.py:80: in __init_subclass_with_meta__
fields.update(yank_fields_from_attrs(base.__dict__, _as=InputField))
graphene/types/utils.py:43: in yank_fields_from_attrs
fields.append((key, get_field_as(value, _as)))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value =
_as =
def get_field_as(value, _as=None):
"""
Get type mounted
"""
if isinstance(value, MountedType):
return value
elif isinstance(value, UnmountedType):
> return value.mount(_as)
E AttributeError: 'MyScalar' object has no attribute 'mount'
graphene/types/utils.py:32: AttributeError
test_inputobjecttype.py::test_inputobjecttype_of_input
def test_inputobjecttype_of_input():
class Child(InputObjectType):
first_name = String()
last_name = String()
@property
def full_name(self):
return f"{self.first_name} {self.last_name}"
class Parent(InputObjectType):
child = InputField(Child)
class Query(ObjectType):
is_child = Boolean(parent=Parent())
def resolve_is_child(self, info, parent):
return (
isinstance(parent.child, Child)
and parent.child.full_name == "Peter Griffin"
)
> schema = Schema(query=Query)
graphene/types/tests/test_inputobjecttype.py:132:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_inputobjecttype.py::test_inputobjecttype_default_input_as_undefined
set_default_input_object_type_to_undefined = None
def test_inputobjecttype_default_input_as_undefined(
set_default_input_object_type_to_undefined,
):
class TestUndefinedInput(InputObjectType):
required_field = String(required=True)
optional_field = String()
class Query(ObjectType):
undefined_optionals_work = Field(NonNull(Boolean), input=TestUndefinedInput())
def resolve_undefined_optionals_work(self, info, input: TestUndefinedInput):
# Confirm that optional_field comes as Undefined
return (
input.required_field == "required" and input.optional_field is Undefined
)
> schema = Schema(query=Query)
graphene/types/tests/test_inputobjecttype.py:160:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_interface.py::test_ordered_fields_in_interface
test_interface.py::test_ordered_fields_in_interface
def test_ordered_fields_in_interface():
> class MyInterface(Interface):
graphene/types/tests/test_interface.py:50:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/subclass_with_meta.py:37: in __init_subclass__
super_class.__init_subclass_with_meta__(**options)
graphene/types/interface.py:50: in __init_subclass_with_meta__
fields.update(yank_fields_from_attrs(base.__dict__, _as=Field))
graphene/types/utils.py:43: in yank_fields_from_attrs
fields.append((key, get_field_as(value, _as)))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value =
_as =
def get_field_as(value, _as=None):
"""
Get type mounted
"""
if isinstance(value, MountedType):
return value
elif isinstance(value, UnmountedType):
> return value.mount(_as)
E AttributeError: 'MyScalar' object has no attribute 'mount'
graphene/types/utils.py:32: AttributeError
test_interface.py::test_generate_interface_unmountedtype
test_interface.py::test_generate_interface_unmountedtype
def test_generate_interface_unmountedtype():
> class MyInterface(Interface):
graphene/types/tests/test_interface.py:60:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/subclass_with_meta.py:37: in __init_subclass__
super_class.__init_subclass_with_meta__(**options)
graphene/types/interface.py:50: in __init_subclass_with_meta__
fields.update(yank_fields_from_attrs(base.__dict__, _as=Field))
graphene/types/utils.py:43: in yank_fields_from_attrs
fields.append((key, get_field_as(value, _as)))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value =
_as =
def get_field_as(value, _as=None):
"""
Get type mounted
"""
if isinstance(value, MountedType):
return value
elif isinstance(value, UnmountedType):
> return value.mount(_as)
E AttributeError: 'MyScalar' object has no attribute 'mount'
graphene/types/utils.py:32: AttributeError
test_interface.py::test_generate_interface_inherit_abstracttype
test_interface.py::test_generate_interface_inherit_abstracttype
def test_generate_interface_inherit_abstracttype():
class MyAbstractType:
field1 = MyScalar()
> class MyInterface(Interface, MyAbstractType):
graphene/types/tests/test_interface.py:71:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/subclass_with_meta.py:37: in __init_subclass__
super_class.__init_subclass_with_meta__(**options)
graphene/types/interface.py:50: in __init_subclass_with_meta__
fields.update(yank_fields_from_attrs(base.__dict__, _as=Field))
graphene/types/utils.py:43: in yank_fields_from_attrs
fields.append((key, get_field_as(value, _as)))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value =
_as =
def get_field_as(value, _as=None):
"""
Get type mounted
"""
if isinstance(value, MountedType):
return value
elif isinstance(value, UnmountedType):
> return value.mount(_as)
E AttributeError: 'MyScalar' object has no attribute 'mount'
graphene/types/utils.py:32: AttributeError
test_interface.py::test_generate_interface_inherit_interface
test_interface.py::test_generate_interface_inherit_interface
def test_generate_interface_inherit_interface():
> class MyBaseInterface(Interface):
graphene/types/tests/test_interface.py:79:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/subclass_with_meta.py:37: in __init_subclass__
super_class.__init_subclass_with_meta__(**options)
graphene/types/interface.py:50: in __init_subclass_with_meta__
fields.update(yank_fields_from_attrs(base.__dict__, _as=Field))
graphene/types/utils.py:43: in yank_fields_from_attrs
fields.append((key, get_field_as(value, _as)))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value =
_as =
def get_field_as(value, _as=None):
"""
Get type mounted
"""
if isinstance(value, MountedType):
return value
elif isinstance(value, UnmountedType):
> return value.mount(_as)
E AttributeError: 'MyScalar' object has no attribute 'mount'
graphene/types/utils.py:32: AttributeError
test_interface.py::test_generate_interface_inherit_abstracttype_reversed
test_interface.py::test_generate_interface_inherit_abstracttype_reversed
def test_generate_interface_inherit_abstracttype_reversed():
class MyAbstractType:
field1 = MyScalar()
> class MyInterface(MyAbstractType, Interface):
graphene/types/tests/test_interface.py:94:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/subclass_with_meta.py:37: in __init_subclass__
super_class.__init_subclass_with_meta__(**options)
graphene/types/interface.py:50: in __init_subclass_with_meta__
fields.update(yank_fields_from_attrs(base.__dict__, _as=Field))
graphene/types/utils.py:43: in yank_fields_from_attrs
fields.append((key, get_field_as(value, _as)))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value =
_as =
def get_field_as(value, _as=None):
"""
Get type mounted
"""
if isinstance(value, MountedType):
return value
elif isinstance(value, UnmountedType):
> return value.mount(_as)
E AttributeError: 'MyScalar' object has no attribute 'mount'
graphene/types/utils.py:32: AttributeError
test_interface.py::test_resolve_type_default
test_interface.py::test_resolve_type_default
def test_resolve_type_default():
class MyInterface(Interface):
field2 = String()
class MyTestType(ObjectType):
class Meta:
interfaces = (MyInterface,)
class Query(ObjectType):
test = Field(MyInterface)
def resolve_test(_, info):
return MyTestType()
> schema = Schema(query=Query, types=[MyTestType])
graphene/types/tests/test_interface.py:115:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None
types = [>]
auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_interface.py::test_resolve_type_custom
test_interface.py::test_resolve_type_custom
def test_resolve_type_custom():
class MyInterface(Interface):
field2 = String()
@classmethod
def resolve_type(cls, instance, info):
if instance["type"] == 1:
return MyTestType1
return MyTestType2
class MyTestType1(ObjectType):
class Meta:
interfaces = (MyInterface,)
class MyTestType2(ObjectType):
class Meta:
interfaces = (MyInterface,)
class Query(ObjectType):
test = Field(MyInterface)
def resolve_test(_, info):
return {"type": 1}
> schema = Schema(query=Query, types=[MyTestType1, MyTestType2])
graphene/types/tests/test_interface.py:154:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None
types = [>, >]
auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_interface.py::test_resolve_type_custom_interferes
test_interface.py::test_resolve_type_custom_interferes
def test_resolve_type_custom_interferes():
class MyInterface(Interface):
field2 = String()
type_ = String(name="type")
def resolve_type_(_, info):
return "foo"
class MyTestType1(ObjectType):
class Meta:
interfaces = (MyInterface,)
class MyTestType2(ObjectType):
class Meta:
interfaces = (MyInterface,)
class Query(ObjectType):
test = Field(MyInterface)
def resolve_test(_, info):
return MyTestType1()
> schema = Schema(query=Query, types=[MyTestType1, MyTestType2])
graphene/types/tests/test_interface.py:191:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None
types = [>, >]
auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_mountedtype.py::test_mounted_type
test_mountedtype.py::test_mounted_type
def test_mounted_type():
unmounted = String()
mounted = Field.mounted(unmounted)
> assert isinstance(mounted, Field)
E assert False
E + where False = isinstance(None, Field)
graphene/types/tests/test_mountedtype.py:14: AssertionError
test_mountedtype.py::test_mounted_type_custom
test_mountedtype.py::test_mounted_type_custom
def test_mounted_type_custom():
unmounted = String(metadata={"hey": "yo!"})
mounted = CustomField.mounted(unmounted)
> assert isinstance(mounted, CustomField)
E assert False
E + where False = isinstance(None, CustomField)
graphene/types/tests/test_mountedtype.py:21: AssertionError
test_mutation.py::test_generate_mutation_no_args
test_mutation.py::test_generate_mutation_no_args
def test_generate_mutation_no_args():
class MyMutation(Mutation):
"""Documentation"""
def mutate(self, info, **args):
return args
assert issubclass(MyMutation, ObjectType)
assert MyMutation._meta.name == "MyMutation"
assert MyMutation._meta.description == "Documentation"
> resolved = MyMutation.Field().resolver(None, None, name="Peter")
E AttributeError: 'NoneType' object has no attribute 'resolver'
graphene/types/tests/test_mutation.py:27: AttributeError
test_mutation.py::test_generate_mutation_with_meta
def test_generate_mutation_with_meta():
class MyMutation(Mutation):
class Meta:
name = "MyOtherMutation"
description = "Documentation"
interfaces = (MyType,)
def mutate(self, info, **args):
return args
assert MyMutation._meta.name == "MyOtherMutation"
assert MyMutation._meta.description == "Documentation"
assert MyMutation._meta.interfaces == (MyType,)
> resolved = MyMutation.Field().resolver(None, None, name="Peter")
E AttributeError: 'NoneType' object has no attribute 'resolver'
graphene/types/tests/test_mutation.py:44: AttributeError
test_mutation.py::test_mutation_custom_output_type
test_mutation.py::test_mutation_custom_output_type
def test_mutation_custom_output_type():
class User(ObjectType):
name = String()
class CreateUser(Mutation):
class Arguments:
name = String()
Output = User
def mutate(self, info, name):
return User(name=name)
field = CreateUser.Field()
> assert field.type == User
E AttributeError: 'NoneType' object has no attribute 'type'
graphene/types/tests/test_mutation.py:71: AttributeError
test_mutation.py::test_mutation_execution
test_mutation.py::test_mutation_execution
def test_mutation_execution():
class CreateUser(Mutation):
class Arguments:
name = String()
dynamic = Dynamic(lambda: String())
dynamic_none = Dynamic(lambda: None)
name = String()
dynamic = Dynamic(lambda: String())
def mutate(self, info, name, dynamic):
return CreateUser(name=name, dynamic=dynamic)
class Query(ObjectType):
a = String()
class MyMutation(ObjectType):
create_user = CreateUser.Field()
> schema = Schema(query=Query, mutation=MyMutation)
graphene/types/tests/test_mutation.py:97:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = >
subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_mutation.py::test_mutation_no_fields_output
test_mutation.py::test_mutation_no_fields_output
def test_mutation_no_fields_output():
class CreateUser(Mutation):
name = String()
def mutate(self, info):
return CreateUser()
class Query(ObjectType):
a = String()
class MyMutation(ObjectType):
create_user = CreateUser.Field()
> schema = Schema(query=Query, mutation=MyMutation)
graphene/types/tests/test_mutation.py:124:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = >
subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_mutation.py::test_mutation_allow_to_have_custom_args
test_mutation.py::test_mutation_allow_to_have_custom_args
def test_mutation_allow_to_have_custom_args():
class CreateUser(Mutation):
class Arguments:
name = String()
name = String()
def mutate(self, info, name):
return CreateUser(name=name)
class MyMutation(ObjectType):
create_user = CreateUser.Field(
name="createUser",
description="Create a user",
deprecation_reason="Is deprecated",
required=True,
)
> field = MyMutation._meta.fields["create_user"]
E KeyError: 'create_user'
graphene/types/tests/test_mutation.py:155: KeyError
test_mutation.py::test_mutation_default_args_output
test_mutation.py::test_mutation_default_args_output
def test_mutation_default_args_output():
class CreateUser(Mutation):
"""Description."""
class Arguments:
name = String()
name = String()
def mutate(self, info, name):
return CreateUser(name=name)
class MyMutation(ObjectType):
create_user = CreateUser.Field()
> field = MyMutation._meta.fields["create_user"]
E KeyError: 'create_user'
graphene/types/tests/test_mutation.py:177: KeyError
test_mutation.py::test_mutation_as_subclass
test_mutation.py::test_mutation_as_subclass
def test_mutation_as_subclass():
class BaseCreateUser(Mutation):
class Arguments:
name = String()
name = String()
def mutate(self, info, **args):
return args
class CreateUserWithPlanet(BaseCreateUser):
class Arguments(BaseCreateUser.Arguments):
planet = String()
planet = String()
def mutate(self, info, **args):
return CreateUserWithPlanet(**args)
class MyMutation(ObjectType):
create_user_with_planet = CreateUserWithPlanet.Field()
class Query(ObjectType):
a = String()
> schema = Schema(query=Query, mutation=MyMutation)
graphene/types/tests/test_mutation.py:209:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = >
subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_objecttype.py::test_generate_lazy_objecttype
test_objecttype.py::test_generate_lazy_objecttype
def test_generate_lazy_objecttype():
class MyObjectType(ObjectType):
example = Field(lambda: InnerObjectType, required=True)
class InnerObjectType(ObjectType):
field = Field(MyType)
assert MyObjectType._meta.name == "MyObjectType"
example_field = MyObjectType._meta.fields["example"]
> assert isinstance(example_field.type, NonNull)
E AttributeError: 'Field' object has no attribute 'type'
graphene/types/tests/test_objecttype.py:73: AttributeError
test_objecttype.py::test_ordered_fields_in_objecttype
test_objecttype.py::test_ordered_fields_in_objecttype
def test_ordered_fields_in_objecttype():
> class MyObjectType(ObjectType):
graphene/types/tests/test_objecttype.py:103:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/objecttype.py:23: in __new__
base_cls = super().__new__(cls, name_, (InterObjectType,) + bases, namespace, **options)
graphene/utils/subclass_with_meta.py:37: in __init_subclass__
super_class.__init_subclass_with_meta__(**options)
graphene/types/objecttype.py:113: in __init_subclass_with_meta__
fields.update(yank_fields_from_attrs(base.__dict__, _as=Field))
graphene/types/utils.py:43: in yank_fields_from_attrs
fields.append((key, get_field_as(value, _as)))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value =
_as =
def get_field_as(value, _as=None):
"""
Get type mounted
"""
if isinstance(value, MountedType):
return value
elif isinstance(value, UnmountedType):
> return value.mount(_as)
E AttributeError: 'MyScalar' object has no attribute 'mount'
graphene/types/utils.py:32: AttributeError
test_objecttype.py::test_generate_objecttype_inherit_abstracttype
test_objecttype.py::test_generate_objecttype_inherit_abstracttype
def test_generate_objecttype_inherit_abstracttype():
class MyAbstractType:
field1 = MyScalar()
> class MyObjectType(ObjectType, MyAbstractType):
graphene/types/tests/test_objecttype.py:116:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/objecttype.py:23: in __new__
base_cls = super().__new__(cls, name_, (InterObjectType,) + bases, namespace, **options)
graphene/utils/subclass_with_meta.py:37: in __init_subclass__
super_class.__init_subclass_with_meta__(**options)
graphene/types/objecttype.py:113: in __init_subclass_with_meta__
fields.update(yank_fields_from_attrs(base.__dict__, _as=Field))
graphene/types/utils.py:43: in yank_fields_from_attrs
fields.append((key, get_field_as(value, _as)))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value =
_as =
def get_field_as(value, _as=None):
"""
Get type mounted
"""
if isinstance(value, MountedType):
return value
elif isinstance(value, UnmountedType):
> return value.mount(_as)
E AttributeError: 'MyScalar' object has no attribute 'mount'
graphene/types/utils.py:32: AttributeError
test_objecttype.py::test_generate_objecttype_inherit_abstracttype_reversed
test_objecttype.py::test_generate_objecttype_inherit_abstracttype_reversed
def test_generate_objecttype_inherit_abstracttype_reversed():
class MyAbstractType:
field1 = MyScalar()
> class MyObjectType(MyAbstractType, ObjectType):
graphene/types/tests/test_objecttype.py:130:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/objecttype.py:23: in __new__
base_cls = super().__new__(cls, name_, (InterObjectType,) + bases, namespace, **options)
graphene/utils/subclass_with_meta.py:37: in __init_subclass__
super_class.__init_subclass_with_meta__(**options)
graphene/types/objecttype.py:113: in __init_subclass_with_meta__
fields.update(yank_fields_from_attrs(base.__dict__, _as=Field))
graphene/types/utils.py:43: in yank_fields_from_attrs
fields.append((key, get_field_as(value, _as)))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value =
_as =
def get_field_as(value, _as=None):
"""
Get type mounted
"""
if isinstance(value, MountedType):
return value
elif isinstance(value, UnmountedType):
> return value.mount(_as)
E AttributeError: 'MyScalar' object has no attribute 'mount'
graphene/types/utils.py:32: AttributeError
test_objecttype.py::test_generate_objecttype_unmountedtype
test_objecttype.py::test_generate_objecttype_unmountedtype
def test_generate_objecttype_unmountedtype():
> class MyObjectType(ObjectType):
graphene/types/tests/test_objecttype.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/objecttype.py:23: in __new__
base_cls = super().__new__(cls, name_, (InterObjectType,) + bases, namespace, **options)
graphene/utils/subclass_with_meta.py:37: in __init_subclass__
super_class.__init_subclass_with_meta__(**options)
graphene/types/objecttype.py:113: in __init_subclass_with_meta__
fields.update(yank_fields_from_attrs(base.__dict__, _as=Field))
graphene/types/utils.py:43: in yank_fields_from_attrs
fields.append((key, get_field_as(value, _as)))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value =
_as =
def get_field_as(value, _as=None):
"""
Get type mounted
"""
if isinstance(value, MountedType):
return value
elif isinstance(value, UnmountedType):
> return value.mount(_as)
E AttributeError: 'MyScalar' object has no attribute 'mount'
graphene/types/utils.py:32: AttributeError
test_objecttype.py::test_objecttype_no_fields_output
test_objecttype.py::test_objecttype_no_fields_output
def test_objecttype_no_fields_output():
class User(ObjectType):
name = String()
class Query(ObjectType):
user = Field(User)
def resolve_user(self, info):
return User()
> schema = Schema(query=Query)
graphene/types/tests/test_objecttype.py:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_objecttype.py::test_objecttype_meta_with_annotations
def test_objecttype_meta_with_annotations():
class Query(ObjectType):
class Meta:
name: str = "oops"
hello = String()
def resolve_hello(self, info):
return "Hello"
> schema = Schema(query=Query)
graphene/types/tests/test_objecttype.py:290:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >, mutation = None
subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_query.py::test_query
test_query.py::test_query
def test_query():
class Query(ObjectType):
hello = String(resolver=lambda *_: "World")
> hello_schema = Schema(Query)
graphene/types/tests/test_query.py:29:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_query.py::test_query_source
test_query.py::test_query_source
def test_query_source():
class Root:
_hello = "World"
def hello(self):
return self._hello
> class Query(ObjectType):
graphene/types/tests/test_query.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/objecttype.py:23: in __new__
base_cls = super().__new__(cls, name_, (InterObjectType,) + bases, namespace, **options)
graphene/utils/subclass_with_meta.py:37: in __init_subclass__
super_class.__init_subclass_with_meta__(**options)
graphene/types/objecttype.py:113: in __init_subclass_with_meta__
fields.update(yank_fields_from_attrs(base.__dict__, _as=Field))
graphene/types/utils.py:43: in yank_fields_from_attrs
fields.append((key, get_field_as(value, _as)))
graphene/types/utils.py:32: in get_field_as
return value.mount(_as)
graphene/types/scalars.py:69: in mount
return Field(self.get_type(), *self.args, **self.kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
type_ = >, args = None
resolver = None, source = 'hello', deprecation_reason = None, name = None
description = None, required = False, _creation_counter = None
default_value = None, extra_args = {}
def __init__(self, type_, args=None, resolver=None, source=None, deprecation_reason=None, name=None, description=None, required=False, _creation_counter=None, default_value=None, **extra_args):
super(Field, self).__init__(_creation_counter=_creation_counter)
assert not args or isinstance(args, Mapping), f'Arguments in a field have to be a mapping, received "{args}".'
assert not (source and resolver), 'A Field cannot have a source and a resolver in at the same time.'
assert not callable(default_value), f'The default value can not be a function but received "{base_type(default_value)}".'
if required:
type_ = NonNull(type_)
if isinstance(name, (Argument, UnmountedType)):
extra_args['name'] = name
name = None
if isinstance(source, (Argument, UnmountedType)):
extra_args['source'] = source
source = None
self.name = name
self._type = type_
self.args = to_arguments(args or {}, extra_args)
if source:
> resolver = partial(source_resolver, source)
E NameError: name 'source_resolver' is not defined
graphene/types/field.py:73: NameError
test_query.py::test_query_union
test_query.py::test_query_union
def test_query_union():
class one_object:
pass
class two_object:
pass
class One(ObjectType):
one = String()
@classmethod
def is_type_of(cls, root, info):
return isinstance(root, one_object)
class Two(ObjectType):
two = String()
@classmethod
def is_type_of(cls, root, info):
return isinstance(root, two_object)
class MyUnion(Union):
class Meta:
types = (One, Two)
> class Query(ObjectType):
graphene/types/tests/test_query.py:78:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/objecttype.py:23: in __new__
base_cls = super().__new__(cls, name_, (InterObjectType,) + bases, namespace, **options)
graphene/utils/subclass_with_meta.py:37: in __init_subclass__
super_class.__init_subclass_with_meta__(**options)
graphene/types/objecttype.py:113: in __init_subclass_with_meta__
fields.update(yank_fields_from_attrs(base.__dict__, _as=Field))
graphene/types/utils.py:43: in yank_fields_from_attrs
fields.append((key, get_field_as(value, _as)))
graphene/types/utils.py:32: in get_field_as
return value.mount(_as)
graphene/types/structures.py:28: in mount
return Field(self.get_type(), *self.args, **self.kwargs)
graphene/types/structures.py:23: in get_type
return get_type(self._of_type)
graphene/types/utils.py:22: in get_type
return get_type(type_())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_ = .MyUnion object at 0x7fe41be6a950>
def get_type(type_):
"""
Returns the type for the given type. It can be:
- A MountedType (which will be returned as is)
- A UnmountedType (which will be mounted)
- A Type string (which will be imported and mounted)
- A callable (which will be called and mounted)
"""
if isinstance(type_, MountedType):
return type_
elif isinstance(type_, UnmountedType):
> return type_.mount()
E AttributeError: 'MyUnion' object has no attribute 'mount'
graphene/types/utils.py:18: AttributeError
test_query.py::test_query_interface
test_query.py::test_query_interface
def test_query_interface():
class one_object:
pass
class two_object:
pass
class MyInterface(Interface):
base = String()
class One(ObjectType):
class Meta:
interfaces = (MyInterface,)
one = String()
@classmethod
def is_type_of(cls, root, info):
return isinstance(root, one_object)
class Two(ObjectType):
class Meta:
interfaces = (MyInterface,)
two = String()
@classmethod
def is_type_of(cls, root, info):
return isinstance(root, two_object)
> class Query(ObjectType):
graphene/types/tests/test_query.py:121:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/objecttype.py:23: in __new__
base_cls = super().__new__(cls, name_, (InterObjectType,) + bases, namespace, **options)
graphene/utils/subclass_with_meta.py:37: in __init_subclass__
super_class.__init_subclass_with_meta__(**options)
graphene/types/objecttype.py:113: in __init_subclass_with_meta__
fields.update(yank_fields_from_attrs(base.__dict__, _as=Field))
graphene/types/utils.py:43: in yank_fields_from_attrs
fields.append((key, get_field_as(value, _as)))
graphene/types/utils.py:32: in get_field_as
return value.mount(_as)
graphene/types/structures.py:28: in mount
return Field(self.get_type(), *self.args, **self.kwargs)
graphene/types/structures.py:23: in get_type
return get_type(self._of_type)
graphene/types/utils.py:22: in get_type
return get_type(type_())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = .MyInterface object at 0x7fe41c0e7310>
args = (), kwargs = {}
def __init__(self, *args, **kwargs):
> raise Exception('An Interface cannot be initialized')
E Exception: An Interface cannot be initialized
graphene/types/interface.py:60: Exception
test_query.py::test_query_dynamic
test_query.py::test_query_dynamic
def test_query_dynamic():
class Query(ObjectType):
hello = Dynamic(lambda: String(resolver=lambda *_: "World"))
hellos = Dynamic(lambda: List(String, resolver=lambda *_: ["Worlds"]))
hello_field = Dynamic(lambda: Field(String, resolver=lambda *_: "Field World"))
> hello_schema = Schema(Query)
graphene/types/tests/test_query.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_query.py::test_query_default_value
test_query.py::test_query_default_value
def test_query_default_value():
class MyType(ObjectType):
field = String()
class Query(ObjectType):
hello = Field(MyType, default_value=MyType(field="something else!"))
> hello_schema = Schema(Query)
graphene/types/tests/test_query.py:160:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_query.py::test_query_wrong_default_value
test_query.py::test_query_wrong_default_value
def test_query_wrong_default_value():
class MyType(ObjectType):
field = String()
@classmethod
def is_type_of(cls, root, info):
return isinstance(root, MyType)
class Query(ObjectType):
hello = Field(MyType, default_value="hello")
> hello_schema = Schema(Query)
graphene/types/tests/test_query.py:178:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_query.py::test_query_default_value_ignored_by_resolver
test_query.py::test_query_default_value_ignored_by_resolver
def test_query_default_value_ignored_by_resolver():
class MyType(ObjectType):
field = String()
class Query(ObjectType):
hello = Field(
MyType,
default_value="hello",
resolver=lambda *_: MyType(field="no default."),
)
> hello_schema = Schema(Query)
graphene/types/tests/test_query.py:200:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_query.py::test_query_resolve_function
test_query.py::test_query_resolve_function
def test_query_resolve_function():
class Query(ObjectType):
hello = String()
def resolve_hello(self, info):
return "World"
> hello_schema = Schema(Query)
graphene/types/tests/test_query.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_query.py::test_query_arguments
test_query.py::test_query_arguments
def test_query_arguments():
class Query(ObjectType):
test = String(a_str=String(), a_int=Int())
def resolve_test(self, info, **args):
return json.dumps([self, args], separators=(",", ":"))
> test_schema = Schema(Query)
graphene/types/tests/test_query.py:228:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_query.py::test_query_input_field
def test_query_input_field():
class Input(InputObjectType):
a_field = String()
recursive_field = InputField(lambda: Input)
class Query(ObjectType):
test = String(a_input=Input())
def resolve_test(self, info, **args):
return json.dumps([self, args], separators=(",", ":"))
> test_schema = Schema(Query)
graphene/types/tests/test_query.py:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_query.py::test_query_middlewares
test_query.py::test_query_middlewares
def test_query_middlewares():
class Query(ObjectType):
hello = String()
other = String()
def resolve_hello(self, info):
return "World"
def resolve_other(self, info):
return "other"
def reversed_middleware(next, *args, **kwargs):
return next(*args, **kwargs)[::-1]
> hello_schema = Schema(Query)
graphene/types/tests/test_query.py:290:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_query.py::test_objecttype_on_instances
test_query.py::test_objecttype_on_instances
def test_objecttype_on_instances():
class Ship:
def __init__(self, name):
self.name = name
class ShipType(ObjectType):
name = String(description="Ship name", required=True)
def resolve_name(self, info):
# Here self will be the Ship instance returned in resolve_ship
return self.name
class Query(ObjectType):
ship = Field(ShipType)
def resolve_ship(self, info):
return Ship(name="xwing")
> schema = Schema(query=Query)
graphene/types/tests/test_query.py:317:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_query.py::test_big_list_query_benchmark
test_query.py::test_big_list_query_benchmark
benchmark =
def test_big_list_query_benchmark(benchmark):
big_list = range(10000)
class Query(ObjectType):
all_ints = List(Int)
def resolve_all_ints(self, info):
return big_list
> hello_schema = Schema(Query)
graphene/types/tests/test_query.py:332:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_query.py::test_big_list_query_compiled_query_benchmark
test_query.py::test_big_list_query_compiled_query_benchmark
benchmark =
def test_big_list_query_compiled_query_benchmark(benchmark):
big_list = range(100000)
class Query(ObjectType):
all_ints = List(Int)
def resolve_all_ints(self, info):
return big_list
> hello_schema = Schema(Query)
graphene/types/tests/test_query.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_query.py::test_big_list_of_containers_query_benchmark
test_query.py::test_big_list_of_containers_query_benchmark
benchmark =
def test_big_list_of_containers_query_benchmark(benchmark):
class Container(ObjectType):
x = Int()
big_container_list = [Container(x=x) for x in range(1000)]
class Query(ObjectType):
all_containers = List(Container)
def resolve_all_containers(self, info):
return big_container_list
> hello_schema = Schema(Query)
graphene/types/tests/test_query.py:372:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_query.py::test_big_list_of_containers_multiple_fields_query_benchmark
test_query.py::test_big_list_of_containers_multiple_fields_query_benchmark
benchmark =
def test_big_list_of_containers_multiple_fields_query_benchmark(benchmark):
class Container(ObjectType):
x = Int()
y = Int()
z = Int()
o = Int()
big_container_list = [Container(x=x, y=x, z=x, o=x) for x in range(1000)]
class Query(ObjectType):
all_containers = List(Container)
def resolve_all_containers(self, info):
return big_container_list
> hello_schema = Schema(Query)
graphene/types/tests/test_query.py:395:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_query.py::test_big_list_of_containers_multiple_fields_custom_resolvers_query_benchmark
test_query.py::test_big_list_of_containers_multiple_fields_custom_resolvers_query_benchmark
benchmark =
def test_big_list_of_containers_multiple_fields_custom_resolvers_query_benchmark(
benchmark,
):
class Container(ObjectType):
x = Int()
y = Int()
z = Int()
o = Int()
def resolve_x(self, info):
return self.x
def resolve_y(self, info):
return self.y
def resolve_z(self, info):
return self.z
def resolve_o(self, info):
return self.o
big_container_list = [Container(x=x, y=x, z=x, o=x) for x in range(1000)]
class Query(ObjectType):
all_containers = List(Container)
def resolve_all_containers(self, info):
return big_container_list
> hello_schema = Schema(Query)
graphene/types/tests/test_query.py:436:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_query.py::test_query_annotated_resolvers
test_query.py::test_query_annotated_resolvers
def test_query_annotated_resolvers():
context = Context(key="context")
class Query(ObjectType):
annotated = String(id=String())
context = String()
info = String()
def resolve_annotated(self, info, id):
return f"{self}-{id}"
def resolve_context(self, info):
assert isinstance(info.context, Context)
return f"{self}-{info.context.key}"
def resolve_info(self, info):
assert isinstance(info, ResolveInfo)
return f"{self}-{info.field_name}"
> test_schema = Schema(Query)
graphene/types/tests/test_query.py:467:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_query.py::test_default_as_kwarg_to_NonNull
test_query.py::test_default_as_kwarg_to_NonNull
def test_default_as_kwarg_to_NonNull():
# Related to https://github.com/graphql-python/graphene/issues/702
class User(ObjectType):
name = String()
is_admin = NonNull(Boolean, default_value=False)
class Query(ObjectType):
user = Field(User)
def resolve_user(self, *args, **kwargs):
return User(name="foo")
> schema = Schema(query=Query)
graphene/types/tests/test_query.py:494:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_scalars_serialization.py::test_serializes_output_int
test_scalars_serialization.py::test_serializes_output_int
def test_serializes_output_int():
assert Int.serialize(1) == 1
assert Int.serialize(0) == 0
assert Int.serialize(-1) == -1
assert Int.serialize(0.1) == 0
assert Int.serialize(1.1) == 1
assert Int.serialize(-1.1) == -1
assert Int.serialize(1e5) == 100000
> assert Int.serialize(9876504321) is Undefined
E assert None is Undefined
E + where None = (9876504321)
E + where = Int.serialize
graphene/types/tests/test_scalars_serialization.py:13: AssertionError
test_scalars_serialization.py::test_serializes_output_float
test_scalars_serialization.py::test_serializes_output_float
def test_serializes_output_float():
assert Float.serialize(1) == 1.0
assert Float.serialize(0) == 0.0
assert Float.serialize(-1) == -1.0
assert Float.serialize(0.1) == 0.1
assert Float.serialize(1.1) == 1.1
assert Float.serialize(-1.1) == -1.1
assert Float.serialize("-1.1") == -1.1
> assert Float.serialize("one") is Undefined
E AssertionError: assert None is Undefined
E + where None = ('one')
E + where = Float.serialize
graphene/types/tests/test_scalars_serialization.py:31: AssertionError
test_scalars_serialization.py::test_serializes_output_string
test_scalars_serialization.py::test_serializes_output_string
def test_serializes_output_string():
assert String.serialize("string") == "string"
assert String.serialize(1) == "1"
assert String.serialize(-1.1) == "-1.1"
> assert String.serialize(True) == "true"
E AssertionError: assert 'True' == 'true'
E
E - true
E ? ^
E + True
E ? ^
graphene/types/tests/test_scalars_serialization.py:40: AssertionError
test_schema.py::test_schema
test_schema.py::test_schema
def test_schema():
> schema = Schema(Query)
graphene/types/tests/test_schema.py:22:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_schema.py::test_schema_get_type
test_schema.py::test_schema_get_type
def test_schema_get_type():
> schema = Schema(Query)
graphene/types/tests/test_schema.py:32:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_schema.py::test_schema_get_type_error
test_schema.py::test_schema_get_type_error
def test_schema_get_type_error():
> schema = Schema(Query)
graphene/types/tests/test_schema.py:38:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_schema.py::test_schema_str
test_schema.py::test_schema_str
def test_schema_str():
> schema = Schema(Query)
graphene/types/tests/test_schema.py:46:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_schema.py::test_schema_introspect
test_schema.py::test_schema_introspect
def test_schema_introspect():
> schema = Schema(Query)
graphene/types/tests/test_schema.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_schema.py::test_schema_requires_query_type
test_schema.py::test_schema_requires_query_type
def test_schema_requires_query_type():
> schema = Schema()
graphene/types/tests/test_schema.py:69:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = None, mutation = None, subscription = None, types = []
auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_structures.py::test_list
test_structures.py::test_list
def test_list():
_list = List(String)
> assert _list.of_type == String
E AttributeError: 'List' object has no attribute 'of_type'
graphene/types/tests/test_structures.py:12: AttributeError
test_structures.py::test_list_with_lazy_type
test_structures.py::test_list_with_lazy_type
def test_list_with_lazy_type():
MyType = object()
field = List(lambda: MyType)
> assert field.of_type == MyType
E AttributeError: 'List' object has no attribute 'of_type'
graphene/types/tests/test_structures.py:29: AttributeError
test_structures.py::test_list_with_lazy_partial_type
test_structures.py::test_list_with_lazy_partial_type
def test_list_with_lazy_partial_type():
MyType = object()
field = List(partial(lambda: MyType))
> assert field.of_type == MyType
E AttributeError: 'List' object has no attribute 'of_type'
graphene/types/tests/test_structures.py:35: AttributeError
test_structures.py::test_list_with_string_type
test_structures.py::test_list_with_string_type
def test_list_with_string_type():
field = List("graphene.types.tests.utils.MyLazyType")
> assert field.of_type == MyLazyType
E AttributeError: 'List' object has no attribute 'of_type'
graphene/types/tests/test_structures.py:40: AttributeError
test_structures.py::test_list_inherited_works_list
test_structures.py::test_list_inherited_works_list
def test_list_inherited_works_list():
_list = List(List(String))
> assert isinstance(_list.of_type, List)
E AttributeError: 'List' object has no attribute 'of_type'
graphene/types/tests/test_structures.py:45: AttributeError
test_structures.py::test_list_inherited_works_nonnull
test_structures.py::test_list_inherited_works_nonnull
def test_list_inherited_works_nonnull():
_list = List(NonNull(String))
> assert isinstance(_list.of_type, NonNull)
E AttributeError: 'List' object has no attribute 'of_type'
graphene/types/tests/test_structures.py:51: AttributeError
test_structures.py::test_nonnull
test_structures.py::test_nonnull
def test_nonnull():
nonnull = NonNull(String)
> assert nonnull.of_type == String
E AttributeError: 'NonNull' object has no attribute 'of_type'
graphene/types/tests/test_structures.py:57: AttributeError
test_structures.py::test_nonnull_with_lazy_type
test_structures.py::test_nonnull_with_lazy_type
def test_nonnull_with_lazy_type():
MyType = object()
field = NonNull(lambda: MyType)
> assert field.of_type == MyType
E AttributeError: 'NonNull' object has no attribute 'of_type'
graphene/types/tests/test_structures.py:64: AttributeError
test_structures.py::test_nonnull_with_lazy_partial_type
test_structures.py::test_nonnull_with_lazy_partial_type
def test_nonnull_with_lazy_partial_type():
MyType = object()
field = NonNull(partial(lambda: MyType))
> assert field.of_type == MyType
E AttributeError: 'NonNull' object has no attribute 'of_type'
graphene/types/tests/test_structures.py:70: AttributeError
test_structures.py::test_nonnull_with_string_type
test_structures.py::test_nonnull_with_string_type
def test_nonnull_with_string_type():
field = NonNull("graphene.types.tests.utils.MyLazyType")
> assert field.of_type == MyLazyType
E AttributeError: 'NonNull' object has no attribute 'of_type'
graphene/types/tests/test_structures.py:75: AttributeError
test_structures.py::test_nonnull_inherited_works_list
test_structures.py::test_nonnull_inherited_works_list
def test_nonnull_inherited_works_list():
_list = NonNull(List(String))
> assert isinstance(_list.of_type, List)
E AttributeError: 'NonNull' object has no attribute 'of_type'
graphene/types/tests/test_structures.py:80: AttributeError
test_structures.py::test_nonnull_inherited_dont_work_nonnull
test_structures.py::test_nonnull_inherited_dont_work_nonnull
def test_nonnull_inherited_dont_work_nonnull():
with raises(Exception) as exc_info:
NonNull(NonNull(String))
> assert (
str(exc_info.value)
== "Can only create NonNull of a Nullable GraphQLType but got: String!."
)
E assert "'NonNull' ob...ute 'of_type'" == 'Can only cre...got: String!.'
E
E - Can only create NonNull of a Nullable GraphQLType but got: String!.
E + 'NonNull' object has no attribute 'of_type'
graphene/types/tests/test_structures.py:88: AssertionError
test_structures.py::test_list_comparasion
test_structures.py::test_list_comparasion
def test_list_comparasion():
list1 = List(String)
list2 = List(String)
list3 = List(None)
list1_argskwargs = List(String, None, b=True)
list2_argskwargs = List(String, None, b=True)
> assert list1 == list2
graphene/types/tests/test_structures.py:112:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
other =
def __eq__(self, other):
> return isinstance(other, List) and (self.of_type == other.of_type and self.args == other.args and (self.kwargs == other.kwargs))
E AttributeError: 'List' object has no attribute 'of_type'
graphene/types/structures.py:51: AttributeError
test_structures.py::test_nonnull_comparasion
test_structures.py::test_nonnull_comparasion
def test_nonnull_comparasion():
nonnull1 = NonNull(String)
nonnull2 = NonNull(String)
nonnull3 = NonNull(None)
nonnull1_argskwargs = NonNull(String, None, b=True)
nonnull2_argskwargs = NonNull(String, None, b=True)
> assert nonnull1 == nonnull2
graphene/types/tests/test_structures.py:126:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
other =
def __eq__(self, other):
> return isinstance(other, NonNull) and (self.of_type == other.of_type and self.args == other.args and (self.kwargs == other.kwargs))
E AttributeError: 'NonNull' object has no attribute 'of_type'
graphene/types/structures.py:84: AttributeError
test_type_map.py::test_enum
test_type_map.py::test_enum
def test_enum():
class MyEnum(Enum):
"""Description"""
foo = 1
bar = 2
@property
def description(self):
return f"Description {self.name}={self.value}"
@property
def deprecation_reason(self):
if self == MyEnum.foo:
return "Is deprecated"
> type_map = create_type_map([MyEnum])
graphene/types/tests/test_type_map.py:49:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/tests/test_type_map.py:29: in create_type_map
schema = Schema(query, types=types, auto_camelcase=auto_camelcase)
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None
types = [>], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_type_map.py::test_objecttype
test_type_map.py::test_objecttype
def test_objecttype():
class MyObjectType(ObjectType):
"""Description"""
foo = String(
bar=String(description="Argument description", default_value="x"),
description="Field description",
)
bar = String(name="gizmo")
def resolve_foo(self, bar):
return bar
> type_map = create_type_map([MyObjectType])
graphene/types/tests/test_type_map.py:76:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/tests/test_type_map.py:29: in create_type_map
schema = Schema(query, types=types, auto_camelcase=auto_camelcase)
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None
types = [>]
auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_type_map.py::test_required_argument_with_default_value
test_type_map.py::test_required_argument_with_default_value
def test_required_argument_with_default_value():
class MyObjectType(ObjectType):
foo = String(bar=String(required=True, default_value="x"))
> type_map = create_type_map([MyObjectType])
graphene/types/tests/test_type_map.py:103:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/tests/test_type_map.py:29: in create_type_map
schema = Schema(query, types=types, auto_camelcase=auto_camelcase)
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None
types = [>]
auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_type_map.py::test_dynamic_objecttype
test_type_map.py::test_dynamic_objecttype
def test_dynamic_objecttype():
class MyObjectType(ObjectType):
"""Description"""
bar = Dynamic(lambda: Field(String))
own = Field(lambda: MyObjectType)
> type_map = create_type_map([MyObjectType])
graphene/types/tests/test_type_map.py:121:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/tests/test_type_map.py:29: in create_type_map
schema = Schema(query, types=types, auto_camelcase=auto_camelcase)
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None
types = [>]
auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_type_map.py::test_interface
test_type_map.py::test_interface
def test_interface():
class MyInterface(Interface):
"""Description"""
foo = String(
bar=String(description="Argument description", default_value="x"),
description="Field description",
)
bar = String(name="gizmo", first_arg=String(), other_arg=String(name="oth_arg"))
own = Field(lambda: MyInterface)
def resolve_foo(self, args, info):
return args.get("bar")
> type_map = create_type_map([MyInterface])
graphene/types/tests/test_type_map.py:146:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/tests/test_type_map.py:29: in create_type_map
schema = Schema(query, types=types, auto_camelcase=auto_camelcase)
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None
types = [>]
auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_type_map.py::test_inputobject
def test_inputobject():
class OtherObjectType(InputObjectType):
thingy = NonNull(Int)
> class MyInnerObjectType(InputObjectType):
graphene/types/tests/test_type_map.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/subclass_with_meta.py:37: in __init_subclass__
super_class.__init_subclass_with_meta__(**options)
graphene/types/inputobjecttype.py:80: in __init_subclass_with_meta__
fields.update(yank_fields_from_attrs(base.__dict__, _as=InputField))
graphene/types/utils.py:43: in yank_fields_from_attrs
fields.append((key, get_field_as(value, _as)))
graphene/types/utils.py:32: in get_field_as
return value.mount(_as)
graphene/types/structures.py:28: in mount
return Field(self.get_type(), *self.args, **self.kwargs)
graphene/types/structures.py:23: in get_type
return get_type(self._of_type)
graphene/types/utils.py:22: in get_type
return get_type(type_())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_ = .OtherObjectType object at 0x7fe41be9b410>
def get_type(type_):
"""
Returns the type for the given type. It can be:
- A MountedType (which will be returned as is)
- A UnmountedType (which will be mounted)
- A Type string (which will be imported and mounted)
- A callable (which will be called and mounted)
"""
if isinstance(type_, MountedType):
return type_
elif isinstance(type_, UnmountedType):
> return type_.mount()
E AttributeError: 'OtherObjectType' object has no attribute 'mount'
graphene/types/utils.py:18: AttributeError
test_type_map.py::test_inputobject_undefined
set_default_input_object_type_to_undefined = None
def test_inputobject_undefined(set_default_input_object_type_to_undefined):
class OtherObjectType(InputObjectType):
optional_field = String()
> type_map = create_type_map([OtherObjectType])
graphene/types/tests/test_type_map.py:234:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/tests/test_type_map.py:29: in create_type_map
schema = Schema(query, types=types, auto_camelcase=auto_camelcase)
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None
types = [>]
auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_type_map.py::test_objecttype_camelcase
test_type_map.py::test_objecttype_camelcase
def test_objecttype_camelcase():
class MyObjectType(ObjectType):
"""Description"""
foo_bar = String(bar_foo=String())
> type_map = create_type_map([MyObjectType])
graphene/types/tests/test_type_map.py:248:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/tests/test_type_map.py:29: in create_type_map
schema = Schema(query, types=types, auto_camelcase=auto_camelcase)
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None
types = [>]
auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_type_map.py::test_objecttype_camelcase_disabled
test_type_map.py::test_objecttype_camelcase_disabled
def test_objecttype_camelcase_disabled():
class MyObjectType(ObjectType):
"""Description"""
foo_bar = String(bar_foo=String())
> type_map = create_type_map([MyObjectType], auto_camelcase=False)
graphene/types/tests/test_type_map.py:272:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/tests/test_type_map.py:29: in create_type_map
schema = Schema(query, types=types, auto_camelcase=auto_camelcase)
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None
types = [>]
auto_camelcase = False
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_type_map.py::test_objecttype_with_possible_types
test_type_map.py::test_objecttype_with_possible_types
def test_objecttype_with_possible_types():
class MyObjectType(ObjectType):
"""Description"""
class Meta:
possible_types = (dict,)
foo_bar = String()
> type_map = create_type_map([MyObjectType])
graphene/types/tests/test_type_map.py:299:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/tests/test_type_map.py:29: in create_type_map
schema = Schema(query, types=types, auto_camelcase=auto_camelcase)
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None
types = [>]
auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_type_map.py::test_interface_with_interfaces
test_type_map.py::test_interface_with_interfaces
def test_interface_with_interfaces():
class FooInterface(Interface):
foo = String()
class BarInterface(Interface):
class Meta:
interfaces = [FooInterface]
foo = String()
bar = String()
> type_map = create_type_map([FooInterface, BarInterface])
graphene/types/tests/test_type_map.py:317:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/tests/test_type_map.py:29: in create_type_map
schema = Schema(query, types=types, auto_camelcase=auto_camelcase)
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None
types = [>, >]
auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_union.py::test_union_can_be_mounted
test_union.py::test_union_can_be_mounted
def test_union_can_be_mounted():
class MyUnion(Union):
class Meta:
types = (MyObjectType1, MyObjectType2)
my_union_instance = MyUnion()
assert isinstance(my_union_instance, UnmountedType)
> my_union_field = my_union_instance.mount_as(Field)
E AttributeError: 'MyUnion' object has no attribute 'mount_as'
graphene/types/tests/test_union.py:56: AttributeError
test_crunch.py::test_crunch[single-item array-uncrunched4-crunched4]
test_crunch.py::test_crunch[single-item array-uncrunched4-crunched4]
description = 'single-item array', uncrunched = [None], crunched = [None, [0]]
@mark.parametrize(
"description,uncrunched,crunched",
[
["number primitive", 0, [0]],
["boolean primitive", True, [True]],
["string primitive", "string", ["string"]],
["empty array", [], [[]]],
["single-item array", [None], [None, [0]]],
[
"multi-primitive all distinct array",
[None, 0, True, "string"],
[None, 0, True, "string", [0, 1, 2, 3]],
],
[
"multi-primitive repeated array",
[True, True, True, True],
[True, [0, 0, 0, 0]],
],
["one-level nested array", [[1, 2, 3]], [1, 2, 3, [0, 1, 2], [3]]],
["two-level nested array", [[[1, 2, 3]]], [1, 2, 3, [0, 1, 2], [3], [4]]],
["empty object", {}, [{}]],
["single-item object", {"a": None}, [None, {"a": 0}]],
[
"multi-item all distinct object",
{"a": None, "b": 0, "c": True, "d": "string"},
[None, 0, True, "string", {"a": 0, "b": 1, "c": 2, "d": 3}],
],
[
"multi-item repeated object",
{"a": True, "b": True, "c": True, "d": True},
[True, {"a": 0, "b": 0, "c": 0, "d": 0}],
],
[
"complex array",
[{"a": True, "b": [1, 2, 3]}, [1, 2, 3]],
[True, 1, 2, 3, [1, 2, 3], {"a": 0, "b": 4}, [5, 4]],
],
[
"complex object",
{"a": True, "b": [1, 2, 3], "c": {"a": True, "b": [1, 2, 3]}},
[True, 1, 2, 3, [1, 2, 3], {"a": 0, "b": 4}, {"a": 0, "b": 4, "c": 5}],
],
],
)
def test_crunch(description, uncrunched, crunched):
> assert crunch(uncrunched) == crunched
E AssertionError: assert [None, '[0]'] == [None, [0]]
E
E At index 1 diff: '[0]' != [0]
E Use -v to get more diff
graphene/utils/tests/test_crunch.py:51: AssertionError
test_crunch.py::test_crunch[multi-primitive all distinct array-uncrunched5-crunched5]
test_crunch.py::test_crunch[multi-primitive all distinct array-uncrunched5-crunched5]
description = 'multi-primitive all distinct array'
uncrunched = [None, 0, True, 'string']
crunched = [None, 0, True, 'string', [0, 1, 2, 3]]
@mark.parametrize(
"description,uncrunched,crunched",
[
["number primitive", 0, [0]],
["boolean primitive", True, [True]],
["string primitive", "string", ["string"]],
["empty array", [], [[]]],
["single-item array", [None], [None, [0]]],
[
"multi-primitive all distinct array",
[None, 0, True, "string"],
[None, 0, True, "string", [0, 1, 2, 3]],
],
[
"multi-primitive repeated array",
[True, True, True, True],
[True, [0, 0, 0, 0]],
],
["one-level nested array", [[1, 2, 3]], [1, 2, 3, [0, 1, 2], [3]]],
["two-level nested array", [[[1, 2, 3]]], [1, 2, 3, [0, 1, 2], [3], [4]]],
["empty object", {}, [{}]],
["single-item object", {"a": None}, [None, {"a": 0}]],
[
"multi-item all distinct object",
{"a": None, "b": 0, "c": True, "d": "string"},
[None, 0, True, "string", {"a": 0, "b": 1, "c": 2, "d": 3}],
],
[
"multi-item repeated object",
{"a": True, "b": True, "c": True, "d": True},
[True, {"a": 0, "b": 0, "c": 0, "d": 0}],
],
[
"complex array",
[{"a": True, "b": [1, 2, 3]}, [1, 2, 3]],
[True, 1, 2, 3, [1, 2, 3], {"a": 0, "b": 4}, [5, 4]],
],
[
"complex object",
{"a": True, "b": [1, 2, 3], "c": {"a": True, "b": [1, 2, 3]}},
[True, 1, 2, 3, [1, 2, 3], {"a": 0, "b": 4}, {"a": 0, "b": 4, "c": 5}],
],
],
)
def test_crunch(description, uncrunched, crunched):
> assert crunch(uncrunched) == crunched
E AssertionError: assert [None, 0, Tru...[0, 1, 2, 3]'] == [None, 0, Tru... [0, 1, 2, 3]]
E
E At index 4 diff: '[0, 1, 2, 3]' != [0, 1, 2, 3]
E Use -v to get more diff
graphene/utils/tests/test_crunch.py:51: AssertionError
test_crunch.py::test_crunch[multi-primitive repeated array-uncrunched6-crunched6]
test_crunch.py::test_crunch[multi-primitive repeated array-uncrunched6-crunched6]
description = 'multi-primitive repeated array'
uncrunched = [True, True, True, True], crunched = [True, [0, 0, 0, 0]]
@mark.parametrize(
"description,uncrunched,crunched",
[
["number primitive", 0, [0]],
["boolean primitive", True, [True]],
["string primitive", "string", ["string"]],
["empty array", [], [[]]],
["single-item array", [None], [None, [0]]],
[
"multi-primitive all distinct array",
[None, 0, True, "string"],
[None, 0, True, "string", [0, 1, 2, 3]],
],
[
"multi-primitive repeated array",
[True, True, True, True],
[True, [0, 0, 0, 0]],
],
["one-level nested array", [[1, 2, 3]], [1, 2, 3, [0, 1, 2], [3]]],
["two-level nested array", [[[1, 2, 3]]], [1, 2, 3, [0, 1, 2], [3], [4]]],
["empty object", {}, [{}]],
["single-item object", {"a": None}, [None, {"a": 0}]],
[
"multi-item all distinct object",
{"a": None, "b": 0, "c": True, "d": "string"},
[None, 0, True, "string", {"a": 0, "b": 1, "c": 2, "d": 3}],
],
[
"multi-item repeated object",
{"a": True, "b": True, "c": True, "d": True},
[True, {"a": 0, "b": 0, "c": 0, "d": 0}],
],
[
"complex array",
[{"a": True, "b": [1, 2, 3]}, [1, 2, 3]],
[True, 1, 2, 3, [1, 2, 3], {"a": 0, "b": 4}, [5, 4]],
],
[
"complex object",
{"a": True, "b": [1, 2, 3], "c": {"a": True, "b": [1, 2, 3]}},
[True, 1, 2, 3, [1, 2, 3], {"a": 0, "b": 4}, {"a": 0, "b": 4, "c": 5}],
],
],
)
def test_crunch(description, uncrunched, crunched):
> assert crunch(uncrunched) == crunched
E AssertionError: assert [True, '[0, 0, 0, 0]'] == [True, [0, 0, 0, 0]]
E
E At index 1 diff: '[0, 0, 0, 0]' != [0, 0, 0, 0]
E Use -v to get more diff
graphene/utils/tests/test_crunch.py:51: AssertionError
test_crunch.py::test_crunch[one-level nested array-uncrunched7-crunched7]
test_crunch.py::test_crunch[one-level nested array-uncrunched7-crunched7]
description = 'one-level nested array', uncrunched = [[1, 2, 3]]
crunched = [1, 2, 3, [0, 1, 2], [3]]
@mark.parametrize(
"description,uncrunched,crunched",
[
["number primitive", 0, [0]],
["boolean primitive", True, [True]],
["string primitive", "string", ["string"]],
["empty array", [], [[]]],
["single-item array", [None], [None, [0]]],
[
"multi-primitive all distinct array",
[None, 0, True, "string"],
[None, 0, True, "string", [0, 1, 2, 3]],
],
[
"multi-primitive repeated array",
[True, True, True, True],
[True, [0, 0, 0, 0]],
],
["one-level nested array", [[1, 2, 3]], [1, 2, 3, [0, 1, 2], [3]]],
["two-level nested array", [[[1, 2, 3]]], [1, 2, 3, [0, 1, 2], [3], [4]]],
["empty object", {}, [{}]],
["single-item object", {"a": None}, [None, {"a": 0}]],
[
"multi-item all distinct object",
{"a": None, "b": 0, "c": True, "d": "string"},
[None, 0, True, "string", {"a": 0, "b": 1, "c": 2, "d": 3}],
],
[
"multi-item repeated object",
{"a": True, "b": True, "c": True, "d": True},
[True, {"a": 0, "b": 0, "c": 0, "d": 0}],
],
[
"complex array",
[{"a": True, "b": [1, 2, 3]}, [1, 2, 3]],
[True, 1, 2, 3, [1, 2, 3], {"a": 0, "b": 4}, [5, 4]],
],
[
"complex object",
{"a": True, "b": [1, 2, 3], "c": {"a": True, "b": [1, 2, 3]}},
[True, 1, 2, 3, [1, 2, 3], {"a": 0, "b": 4}, {"a": 0, "b": 4, "c": 5}],
],
],
)
def test_crunch(description, uncrunched, crunched):
> assert crunch(uncrunched) == crunched
E assert [1, 2, 3, '[0... 2]"]', '[4]'] == [1, 2, 3, [0, 1, 2], [3]]
E
E At index 3 diff: '[0, 1, 2]' != [0, 1, 2]
E Left contains one more item: '[4]'
E Use -v to get more diff
graphene/utils/tests/test_crunch.py:51: AssertionError
test_crunch.py::test_crunch[two-level nested array-uncrunched8-crunched8]
test_crunch.py::test_crunch[two-level nested array-uncrunched8-crunched8]
description = 'two-level nested array', uncrunched = [[[1, 2, 3]]]
crunched = [1, 2, 3, [0, 1, 2], [3], [4]]
@mark.parametrize(
"description,uncrunched,crunched",
[
["number primitive", 0, [0]],
["boolean primitive", True, [True]],
["string primitive", "string", ["string"]],
["empty array", [], [[]]],
["single-item array", [None], [None, [0]]],
[
"multi-primitive all distinct array",
[None, 0, True, "string"],
[None, 0, True, "string", [0, 1, 2, 3]],
],
[
"multi-primitive repeated array",
[True, True, True, True],
[True, [0, 0, 0, 0]],
],
["one-level nested array", [[1, 2, 3]], [1, 2, 3, [0, 1, 2], [3]]],
["two-level nested array", [[[1, 2, 3]]], [1, 2, 3, [0, 1, 2], [3], [4]]],
["empty object", {}, [{}]],
["single-item object", {"a": None}, [None, {"a": 0}]],
[
"multi-item all distinct object",
{"a": None, "b": 0, "c": True, "d": "string"},
[None, 0, True, "string", {"a": 0, "b": 1, "c": 2, "d": 3}],
],
[
"multi-item repeated object",
{"a": True, "b": True, "c": True, "d": True},
[True, {"a": 0, "b": 0, "c": 0, "d": 0}],
],
[
"complex array",
[{"a": True, "b": [1, 2, 3]}, [1, 2, 3]],
[True, 1, 2, 3, [1, 2, 3], {"a": 0, "b": 4}, [5, 4]],
],
[
"complex object",
{"a": True, "b": [1, 2, 3], "c": {"a": True, "b": [1, 2, 3]}},
[True, 1, 2, 3, [1, 2, 3], {"a": 0, "b": 4}, {"a": 0, "b": 4, "c": 5}],
],
],
)
def test_crunch(description, uncrunched, crunched):
> assert crunch(uncrunched) == crunched
E assert [1, 2, 3, '[0...', '[4]', ...] == [1, 2, 3, [0, 1, 2], [3], [4]]
E
E At index 3 diff: '[0, 1, 2]' != [0, 1, 2]
E Left contains 2 more items, first extra item: '[1, 2, 3, "[0, 1, 2]", "[1, 2, 3, \\"[0, 1, 2]\\"]", "[4]"]'
E Use -v to get more diff
graphene/utils/tests/test_crunch.py:51: AssertionError
test_crunch.py::test_crunch[single-item object-uncrunched10-crunched10]
test_crunch.py::test_crunch[single-item object-uncrunched10-crunched10]
description = 'single-item object', uncrunched = {'a': None}
crunched = [None, {'a': 0}]
@mark.parametrize(
"description,uncrunched,crunched",
[
["number primitive", 0, [0]],
["boolean primitive", True, [True]],
["string primitive", "string", ["string"]],
["empty array", [], [[]]],
["single-item array", [None], [None, [0]]],
[
"multi-primitive all distinct array",
[None, 0, True, "string"],
[None, 0, True, "string", [0, 1, 2, 3]],
],
[
"multi-primitive repeated array",
[True, True, True, True],
[True, [0, 0, 0, 0]],
],
["one-level nested array", [[1, 2, 3]], [1, 2, 3, [0, 1, 2], [3]]],
["two-level nested array", [[[1, 2, 3]]], [1, 2, 3, [0, 1, 2], [3], [4]]],
["empty object", {}, [{}]],
["single-item object", {"a": None}, [None, {"a": 0}]],
[
"multi-item all distinct object",
{"a": None, "b": 0, "c": True, "d": "string"},
[None, 0, True, "string", {"a": 0, "b": 1, "c": 2, "d": 3}],
],
[
"multi-item repeated object",
{"a": True, "b": True, "c": True, "d": True},
[True, {"a": 0, "b": 0, "c": 0, "d": 0}],
],
[
"complex array",
[{"a": True, "b": [1, 2, 3]}, [1, 2, 3]],
[True, 1, 2, 3, [1, 2, 3], {"a": 0, "b": 4}, [5, 4]],
],
[
"complex object",
{"a": True, "b": [1, 2, 3], "c": {"a": True, "b": [1, 2, 3]}},
[True, 1, 2, 3, [1, 2, 3], {"a": 0, "b": 4}, {"a": 0, "b": 4, "c": 5}],
],
],
)
def test_crunch(description, uncrunched, crunched):
> assert crunch(uncrunched) == crunched
E assert [None, '{"a": 0}'] == [None, {'a': 0}]
E
E At index 1 diff: '{"a": 0}' != {'a': 0}
E Use -v to get more diff
graphene/utils/tests/test_crunch.py:51: AssertionError
test_crunch.py::test_crunch[multi-item all distinct object-uncrunched11-crunched11]
test_crunch.py::test_crunch[multi-item all distinct object-uncrunched11-crunched11]
description = 'multi-item all distinct object'
uncrunched = {'a': None, 'b': 0, 'c': True, 'd': 'string'}
crunched = [None, 0, True, 'string', {'a': 0, 'b': 1, 'c': 2, 'd': 3}]
@mark.parametrize(
"description,uncrunched,crunched",
[
["number primitive", 0, [0]],
["boolean primitive", True, [True]],
["string primitive", "string", ["string"]],
["empty array", [], [[]]],
["single-item array", [None], [None, [0]]],
[
"multi-primitive all distinct array",
[None, 0, True, "string"],
[None, 0, True, "string", [0, 1, 2, 3]],
],
[
"multi-primitive repeated array",
[True, True, True, True],
[True, [0, 0, 0, 0]],
],
["one-level nested array", [[1, 2, 3]], [1, 2, 3, [0, 1, 2], [3]]],
["two-level nested array", [[[1, 2, 3]]], [1, 2, 3, [0, 1, 2], [3], [4]]],
["empty object", {}, [{}]],
["single-item object", {"a": None}, [None, {"a": 0}]],
[
"multi-item all distinct object",
{"a": None, "b": 0, "c": True, "d": "string"},
[None, 0, True, "string", {"a": 0, "b": 1, "c": 2, "d": 3}],
],
[
"multi-item repeated object",
{"a": True, "b": True, "c": True, "d": True},
[True, {"a": 0, "b": 0, "c": 0, "d": 0}],
],
[
"complex array",
[{"a": True, "b": [1, 2, 3]}, [1, 2, 3]],
[True, 1, 2, 3, [1, 2, 3], {"a": 0, "b": 4}, [5, 4]],
],
[
"complex object",
{"a": True, "b": [1, 2, 3], "c": {"a": True, "b": [1, 2, 3]}},
[True, 1, 2, 3, [1, 2, 3], {"a": 0, "b": 4}, {"a": 0, "b": 4, "c": 5}],
],
],
)
def test_crunch(description, uncrunched, crunched):
> assert crunch(uncrunched) == crunched
E assert [None, 0, Tru...: 2, "d": 3}'] == [None, 0, Tru...': 2, 'd': 3}]
E
E At index 4 diff: '{"a": 0, "b": 1, "c": 2, "d": 3}' != {'a': 0, 'b': 1, 'c': 2, 'd': 3}
E Use -v to get more diff
graphene/utils/tests/test_crunch.py:51: AssertionError
test_crunch.py::test_crunch[multi-item repeated object-uncrunched12-crunched12]
test_crunch.py::test_crunch[multi-item repeated object-uncrunched12-crunched12]
description = 'multi-item repeated object'
uncrunched = {'a': True, 'b': True, 'c': True, 'd': True}
crunched = [True, {'a': 0, 'b': 0, 'c': 0, 'd': 0}]
@mark.parametrize(
"description,uncrunched,crunched",
[
["number primitive", 0, [0]],
["boolean primitive", True, [True]],
["string primitive", "string", ["string"]],
["empty array", [], [[]]],
["single-item array", [None], [None, [0]]],
[
"multi-primitive all distinct array",
[None, 0, True, "string"],
[None, 0, True, "string", [0, 1, 2, 3]],
],
[
"multi-primitive repeated array",
[True, True, True, True],
[True, [0, 0, 0, 0]],
],
["one-level nested array", [[1, 2, 3]], [1, 2, 3, [0, 1, 2], [3]]],
["two-level nested array", [[[1, 2, 3]]], [1, 2, 3, [0, 1, 2], [3], [4]]],
["empty object", {}, [{}]],
["single-item object", {"a": None}, [None, {"a": 0}]],
[
"multi-item all distinct object",
{"a": None, "b": 0, "c": True, "d": "string"},
[None, 0, True, "string", {"a": 0, "b": 1, "c": 2, "d": 3}],
],
[
"multi-item repeated object",
{"a": True, "b": True, "c": True, "d": True},
[True, {"a": 0, "b": 0, "c": 0, "d": 0}],
],
[
"complex array",
[{"a": True, "b": [1, 2, 3]}, [1, 2, 3]],
[True, 1, 2, 3, [1, 2, 3], {"a": 0, "b": 4}, [5, 4]],
],
[
"complex object",
{"a": True, "b": [1, 2, 3], "c": {"a": True, "b": [1, 2, 3]}},
[True, 1, 2, 3, [1, 2, 3], {"a": 0, "b": 4}, {"a": 0, "b": 4, "c": 5}],
],
],
)
def test_crunch(description, uncrunched, crunched):
> assert crunch(uncrunched) == crunched
E assert [True, '{"a":...: 0, "d": 0}'] == [True, {'a': ...': 0, 'd': 0}]
E
E At index 1 diff: '{"a": 0, "b": 0, "c": 0, "d": 0}' != {'a': 0, 'b': 0, 'c': 0, 'd': 0}
E Use -v to get more diff
graphene/utils/tests/test_crunch.py:51: AssertionError
test_crunch.py::test_crunch[complex array-uncrunched13-crunched13]
test_crunch.py::test_crunch[complex array-uncrunched13-crunched13]
description = 'complex array'
uncrunched = [{'a': True, 'b': [1, 2, 3]}, [1, 2, 3]]
crunched = [True, 1, 2, 3, [1, 2, 3], {'a': 0, 'b': 4}, ...]
@mark.parametrize(
"description,uncrunched,crunched",
[
["number primitive", 0, [0]],
["boolean primitive", True, [True]],
["string primitive", "string", ["string"]],
["empty array", [], [[]]],
["single-item array", [None], [None, [0]]],
[
"multi-primitive all distinct array",
[None, 0, True, "string"],
[None, 0, True, "string", [0, 1, 2, 3]],
],
[
"multi-primitive repeated array",
[True, True, True, True],
[True, [0, 0, 0, 0]],
],
["one-level nested array", [[1, 2, 3]], [1, 2, 3, [0, 1, 2], [3]]],
["two-level nested array", [[[1, 2, 3]]], [1, 2, 3, [0, 1, 2], [3], [4]]],
["empty object", {}, [{}]],
["single-item object", {"a": None}, [None, {"a": 0}]],
[
"multi-item all distinct object",
{"a": None, "b": 0, "c": True, "d": "string"},
[None, 0, True, "string", {"a": 0, "b": 1, "c": 2, "d": 3}],
],
[
"multi-item repeated object",
{"a": True, "b": True, "c": True, "d": True},
[True, {"a": 0, "b": 0, "c": 0, "d": 0}],
],
[
"complex array",
[{"a": True, "b": [1, 2, 3]}, [1, 2, 3]],
[True, 1, 2, 3, [1, 2, 3], {"a": 0, "b": 4}, [5, 4]],
],
[
"complex object",
{"a": True, "b": [1, 2, 3], "c": {"a": True, "b": [1, 2, 3]}},
[True, 1, 2, 3, [1, 2, 3], {"a": 0, "b": 4}, {"a": 0, "b": 4, "c": 5}],
],
],
)
def test_crunch(description, uncrunched, crunched):
> assert crunch(uncrunched) == crunched
E assert [True, 2, 3, ..."b": 4}', ...] == [True, 1, 2, ... 'b': 4}, ...]
E
E At index 1 diff: 2 != 1
E Left contains 2 more items, first extra item: '[true, 2, 3, [0, 1, 2]]'
E Use -v to get more diff
graphene/utils/tests/test_crunch.py:51: AssertionError
test_crunch.py::test_crunch[complex object-uncrunched14-crunched14]
test_crunch.py::test_crunch[complex object-uncrunched14-crunched14]
description = 'complex object'
uncrunched = {'a': True, 'b': [1, 2, 3], 'c': {'a': True, 'b': [1, 2, 3]}}
crunched = [True, 1, 2, 3, [1, 2, 3], {'a': 0, 'b': 4}, ...]
@mark.parametrize(
"description,uncrunched,crunched",
[
["number primitive", 0, [0]],
["boolean primitive", True, [True]],
["string primitive", "string", ["string"]],
["empty array", [], [[]]],
["single-item array", [None], [None, [0]]],
[
"multi-primitive all distinct array",
[None, 0, True, "string"],
[None, 0, True, "string", [0, 1, 2, 3]],
],
[
"multi-primitive repeated array",
[True, True, True, True],
[True, [0, 0, 0, 0]],
],
["one-level nested array", [[1, 2, 3]], [1, 2, 3, [0, 1, 2], [3]]],
["two-level nested array", [[[1, 2, 3]]], [1, 2, 3, [0, 1, 2], [3], [4]]],
["empty object", {}, [{}]],
["single-item object", {"a": None}, [None, {"a": 0}]],
[
"multi-item all distinct object",
{"a": None, "b": 0, "c": True, "d": "string"},
[None, 0, True, "string", {"a": 0, "b": 1, "c": 2, "d": 3}],
],
[
"multi-item repeated object",
{"a": True, "b": True, "c": True, "d": True},
[True, {"a": 0, "b": 0, "c": 0, "d": 0}],
],
[
"complex array",
[{"a": True, "b": [1, 2, 3]}, [1, 2, 3]],
[True, 1, 2, 3, [1, 2, 3], {"a": 0, "b": 4}, [5, 4]],
],
[
"complex object",
{"a": True, "b": [1, 2, 3], "c": {"a": True, "b": [1, 2, 3]}},
[True, 1, 2, 3, [1, 2, 3], {"a": 0, "b": 4}, {"a": 0, "b": 4, "c": 5}],
],
],
)
def test_crunch(description, uncrunched, crunched):
> assert crunch(uncrunched) == crunched
E assert [True, 2, 3, ... 1, 2]]', ...] == [True, 1, 2, ... 'b': 4}, ...]
E
E At index 1 diff: 2 != 1
E Left contains 2 more items, first extra item: '[true, 2, 3, "[0, 1, 2]", "[true, 2, 3, \\"[0, 1, 2]\\"]", "[true, 2, 3, [0, 1, 2]]", "{\\"a\\": 0, \\"b\\": 5}"]'
E Use -v to get more diff
graphene/utils/tests/test_crunch.py:51: AssertionError
test_dataloader.py::test_basic_dataloader
test_dataloader.py::test_basic_dataloader
@mark.asyncio
async def test_basic_dataloader():
> schema = Schema(query=Query)
graphene/utils/tests/test_dataloader.py:52:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/types/schema.py:90: in __init__
type_map = TypeMap(query, mutation, subscription, types, auto_camelcase=auto_camelcase)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = {}, query = >
mutation = None, subscription = None, types = [], auto_camelcase = True
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
assert_valid_root_type(query)
assert_valid_root_type(mutation)
assert_valid_root_type(subscription)
if types is None:
types = []
for type_ in types:
assert is_graphene_type(type_)
self.auto_camelcase = auto_camelcase
> create_graphql_type = self.add_type
E AttributeError: 'TypeMap' object has no attribute 'add_type'
graphene/types/schema.py:50: AttributeError
test_dataloader.py::test_build_a_simple_data_loader
test_dataloader.py::test_build_a_simple_data_loader
@mark.asyncio
async def test_build_a_simple_data_loader():
async def call_fn(keys):
return keys
> identity_loader = DataLoader(call_fn)
graphene/utils/tests/test_dataloader.py:105:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
batch_load_fn = .call_fn at 0x7fe41c754040>
batch = None, max_batch_size = None, cache = None, get_cache_key = None
cache_map = None, loop = None
def __init__(self, batch_load_fn=None, batch=None, max_batch_size=None, cache=None, get_cache_key=None, cache_map=None, loop=None):
self._loop = loop
if batch_load_fn is not None:
self.batch_load_fn = batch_load_fn
> assert iscoroutinefunctionorpartial(self.batch_load_fn), 'batch_load_fn must be coroutine. Received: {}'.format(self.batch_load_fn)
E NameError: name 'iscoroutinefunctionorpartial' is not defined
graphene/utils/dataloader.py:17: NameError
test_dataloader.py::test_can_build_a_data_loader_from_a_partial
test_dataloader.py::test_can_build_a_data_loader_from_a_partial
@mark.asyncio
async def test_can_build_a_data_loader_from_a_partial():
value_map = {1: "one"}
async def call_fn(context, keys):
return [context.get(key) for key in keys]
partial_fn = partial(call_fn, value_map)
> identity_loader = DataLoader(partial_fn)
graphene/utils/tests/test_dataloader.py:121:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
batch_load_fn = functools.partial(.call_fn at 0x7fe41c6b51c0>, {1: 'one'})
batch = None, max_batch_size = None, cache = None, get_cache_key = None
cache_map = None, loop = None
def __init__(self, batch_load_fn=None, batch=None, max_batch_size=None, cache=None, get_cache_key=None, cache_map=None, loop=None):
self._loop = loop
if batch_load_fn is not None:
self.batch_load_fn = batch_load_fn
> assert iscoroutinefunctionorpartial(self.batch_load_fn), 'batch_load_fn must be coroutine. Received: {}'.format(self.batch_load_fn)
E NameError: name 'iscoroutinefunctionorpartial' is not defined
graphene/utils/dataloader.py:17: NameError
test_dataloader.py::test_supports_loading_multiple_keys_in_one_call
test_dataloader.py::test_supports_loading_multiple_keys_in_one_call
@mark.asyncio
async def test_supports_loading_multiple_keys_in_one_call():
async def call_fn(keys):
return keys
> identity_loader = DataLoader(call_fn)
graphene/utils/tests/test_dataloader.py:134:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
batch_load_fn = .call_fn at 0x7fe41c6b7380>
batch = None, max_batch_size = None, cache = None, get_cache_key = None
cache_map = None, loop = None
def __init__(self, batch_load_fn=None, batch=None, max_batch_size=None, cache=None, get_cache_key=None, cache_map=None, loop=None):
self._loop = loop
if batch_load_fn is not None:
self.batch_load_fn = batch_load_fn
> assert iscoroutinefunctionorpartial(self.batch_load_fn), 'batch_load_fn must be coroutine. Received: {}'.format(self.batch_load_fn)
E NameError: name 'iscoroutinefunctionorpartial' is not defined
graphene/utils/dataloader.py:17: NameError
test_dataloader.py::test_batches_multiple_requests
test_dataloader.py::test_batches_multiple_requests
@mark.asyncio
async def test_batches_multiple_requests():
> identity_loader, load_calls = id_loader()
graphene/utils/tests/test_dataloader.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/tests/test_dataloader.py:96: in id_loader
identity_loader = DataLoader(fn, **options)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
batch_load_fn = .fn at 0x7fe41c756c00>, batch = None
max_batch_size = None, cache = None, get_cache_key = None, cache_map = None
loop = None
def __init__(self, batch_load_fn=None, batch=None, max_batch_size=None, cache=None, get_cache_key=None, cache_map=None, loop=None):
self._loop = loop
if batch_load_fn is not None:
self.batch_load_fn = batch_load_fn
> assert iscoroutinefunctionorpartial(self.batch_load_fn), 'batch_load_fn must be coroutine. Received: {}'.format(self.batch_load_fn)
E NameError: name 'iscoroutinefunctionorpartial' is not defined
graphene/utils/dataloader.py:17: NameError
test_dataloader.py::test_batches_multiple_requests_with_max_batch_sizes
test_dataloader.py::test_batches_multiple_requests_with_max_batch_sizes
@mark.asyncio
async def test_batches_multiple_requests_with_max_batch_sizes():
> identity_loader, load_calls = id_loader(max_batch_size=2)
graphene/utils/tests/test_dataloader.py:166:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/tests/test_dataloader.py:96: in id_loader
identity_loader = DataLoader(fn, **options)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
batch_load_fn = .fn at 0x7fe41c5860c0>, batch = None
max_batch_size = 2, cache = None, get_cache_key = None, cache_map = None
loop = None
def __init__(self, batch_load_fn=None, batch=None, max_batch_size=None, cache=None, get_cache_key=None, cache_map=None, loop=None):
self._loop = loop
if batch_load_fn is not None:
self.batch_load_fn = batch_load_fn
> assert iscoroutinefunctionorpartial(self.batch_load_fn), 'batch_load_fn must be coroutine. Received: {}'.format(self.batch_load_fn)
E NameError: name 'iscoroutinefunctionorpartial' is not defined
graphene/utils/dataloader.py:17: NameError
test_dataloader.py::test_coalesces_identical_requests
test_dataloader.py::test_coalesces_identical_requests
@mark.asyncio
async def test_coalesces_identical_requests():
> identity_loader, load_calls = id_loader()
graphene/utils/tests/test_dataloader.py:185:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/tests/test_dataloader.py:96: in id_loader
identity_loader = DataLoader(fn, **options)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
batch_load_fn = .fn at 0x7fe41c756c00>, batch = None
max_batch_size = None, cache = None, get_cache_key = None, cache_map = None
loop = None
def __init__(self, batch_load_fn=None, batch=None, max_batch_size=None, cache=None, get_cache_key=None, cache_map=None, loop=None):
self._loop = loop
if batch_load_fn is not None:
self.batch_load_fn = batch_load_fn
> assert iscoroutinefunctionorpartial(self.batch_load_fn), 'batch_load_fn must be coroutine. Received: {}'.format(self.batch_load_fn)
E NameError: name 'iscoroutinefunctionorpartial' is not defined
graphene/utils/dataloader.py:17: NameError
test_dataloader.py::test_caches_repeated_requests
test_dataloader.py::test_caches_repeated_requests
@mark.asyncio
async def test_caches_repeated_requests():
> identity_loader, load_calls = id_loader()
graphene/utils/tests/test_dataloader.py:203:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/tests/test_dataloader.py:96: in id_loader
identity_loader = DataLoader(fn, **options)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
batch_load_fn = .fn at 0x7fe41c585760>, batch = None
max_batch_size = None, cache = None, get_cache_key = None, cache_map = None
loop = None
def __init__(self, batch_load_fn=None, batch=None, max_batch_size=None, cache=None, get_cache_key=None, cache_map=None, loop=None):
self._loop = loop
if batch_load_fn is not None:
self.batch_load_fn = batch_load_fn
> assert iscoroutinefunctionorpartial(self.batch_load_fn), 'batch_load_fn must be coroutine. Received: {}'.format(self.batch_load_fn)
E NameError: name 'iscoroutinefunctionorpartial' is not defined
graphene/utils/dataloader.py:17: NameError
test_dataloader.py::test_clears_single_value_in_loader
test_dataloader.py::test_clears_single_value_in_loader
@mark.asyncio
async def test_clears_single_value_in_loader():
> identity_loader, load_calls = id_loader()
graphene/utils/tests/test_dataloader.py:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/tests/test_dataloader.py:96: in id_loader
identity_loader = DataLoader(fn, **options)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
batch_load_fn = .fn at 0x7fe41c585260>, batch = None
max_batch_size = None, cache = None, get_cache_key = None, cache_map = None
loop = None
def __init__(self, batch_load_fn=None, batch=None, max_batch_size=None, cache=None, get_cache_key=None, cache_map=None, loop=None):
self._loop = loop
if batch_load_fn is not None:
self.batch_load_fn = batch_load_fn
> assert iscoroutinefunctionorpartial(self.batch_load_fn), 'batch_load_fn must be coroutine. Received: {}'.format(self.batch_load_fn)
E NameError: name 'iscoroutinefunctionorpartial' is not defined
graphene/utils/dataloader.py:17: NameError
test_dataloader.py::test_clears_all_values_in_loader
test_dataloader.py::test_clears_all_values_in_loader
@mark.asyncio
async def test_clears_all_values_in_loader():
> identity_loader, load_calls = id_loader()
graphene/utils/tests/test_dataloader.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/tests/test_dataloader.py:96: in id_loader
identity_loader = DataLoader(fn, **options)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
batch_load_fn = .fn at 0x7fe41c4f1440>, batch = None
max_batch_size = None, cache = None, get_cache_key = None, cache_map = None
loop = None
def __init__(self, batch_load_fn=None, batch=None, max_batch_size=None, cache=None, get_cache_key=None, cache_map=None, loop=None):
self._loop = loop
if batch_load_fn is not None:
self.batch_load_fn = batch_load_fn
> assert iscoroutinefunctionorpartial(self.batch_load_fn), 'batch_load_fn must be coroutine. Received: {}'.format(self.batch_load_fn)
E NameError: name 'iscoroutinefunctionorpartial' is not defined
graphene/utils/dataloader.py:17: NameError
test_dataloader.py::test_allows_priming_the_cache
test_dataloader.py::test_allows_priming_the_cache
@mark.asyncio
async def test_allows_priming_the_cache():
> identity_loader, load_calls = id_loader()
graphene/utils/tests/test_dataloader.py:274:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/tests/test_dataloader.py:96: in id_loader
identity_loader = DataLoader(fn, **options)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
batch_load_fn = .fn at 0x7fe41c617ce0>, batch = None
max_batch_size = None, cache = None, get_cache_key = None, cache_map = None
loop = None
def __init__(self, batch_load_fn=None, batch=None, max_batch_size=None, cache=None, get_cache_key=None, cache_map=None, loop=None):
self._loop = loop
if batch_load_fn is not None:
self.batch_load_fn = batch_load_fn
> assert iscoroutinefunctionorpartial(self.batch_load_fn), 'batch_load_fn must be coroutine. Received: {}'.format(self.batch_load_fn)
E NameError: name 'iscoroutinefunctionorpartial' is not defined
graphene/utils/dataloader.py:17: NameError
test_dataloader.py::test_does_not_prime_keys_that_already_exist
test_dataloader.py::test_does_not_prime_keys_that_already_exist
@mark.asyncio
async def test_does_not_prime_keys_that_already_exist():
> identity_loader, load_calls = id_loader()
graphene/utils/tests/test_dataloader.py:288:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/tests/test_dataloader.py:96: in id_loader
identity_loader = DataLoader(fn, **options)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
batch_load_fn = .fn at 0x7fe41c3f8860>, batch = None
max_batch_size = None, cache = None, get_cache_key = None, cache_map = None
loop = None
def __init__(self, batch_load_fn=None, batch=None, max_batch_size=None, cache=None, get_cache_key=None, cache_map=None, loop=None):
self._loop = loop
if batch_load_fn is not None:
self.batch_load_fn = batch_load_fn
> assert iscoroutinefunctionorpartial(self.batch_load_fn), 'batch_load_fn must be coroutine. Received: {}'.format(self.batch_load_fn)
E NameError: name 'iscoroutinefunctionorpartial' is not defined
graphene/utils/dataloader.py:17: NameError
test_dataloader.py::test_resolves_to_error_to_indicate_failure
test_dataloader.py::test_resolves_to_error_to_indicate_failure
@mark.asyncio
async def test_resolves_to_error_to_indicate_failure():
async def resolve(keys):
mapped_keys = [
key if key % 2 == 0 else Exception("Odd: {}".format(key)) for key in keys
]
return mapped_keys
> even_loader, load_calls = id_loader(resolve=resolve)
graphene/utils/tests/test_dataloader.py:319:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/tests/test_dataloader.py:96: in id_loader
identity_loader = DataLoader(fn, **options)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
batch_load_fn = .fn at 0x7fe41c3f9620>, batch = None
max_batch_size = None, cache = None, get_cache_key = None, cache_map = None
loop = None
def __init__(self, batch_load_fn=None, batch=None, max_batch_size=None, cache=None, get_cache_key=None, cache_map=None, loop=None):
self._loop = loop
if batch_load_fn is not None:
self.batch_load_fn = batch_load_fn
> assert iscoroutinefunctionorpartial(self.batch_load_fn), 'batch_load_fn must be coroutine. Received: {}'.format(self.batch_load_fn)
E NameError: name 'iscoroutinefunctionorpartial' is not defined
graphene/utils/dataloader.py:17: NameError
test_dataloader.py::test_can_represent_failures_and_successes_simultaneously
test_dataloader.py::test_can_represent_failures_and_successes_simultaneously
@mark.asyncio
async def test_can_represent_failures_and_successes_simultaneously():
async def resolve(keys):
mapped_keys = [
key if key % 2 == 0 else Exception("Odd: {}".format(key)) for key in keys
]
return mapped_keys
> even_loader, load_calls = id_loader(resolve=resolve)
graphene/utils/tests/test_dataloader.py:339:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/tests/test_dataloader.py:96: in id_loader
identity_loader = DataLoader(fn, **options)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
batch_load_fn = .fn at 0x7fe41c3f99e0>, batch = None
max_batch_size = None, cache = None, get_cache_key = None, cache_map = None
loop = None
def __init__(self, batch_load_fn=None, batch=None, max_batch_size=None, cache=None, get_cache_key=None, cache_map=None, loop=None):
self._loop = loop
if batch_load_fn is not None:
self.batch_load_fn = batch_load_fn
> assert iscoroutinefunctionorpartial(self.batch_load_fn), 'batch_load_fn must be coroutine. Received: {}'.format(self.batch_load_fn)
E NameError: name 'iscoroutinefunctionorpartial' is not defined
graphene/utils/dataloader.py:17: NameError
test_dataloader.py::test_caches_failed_fetches
test_dataloader.py::test_caches_failed_fetches
@mark.asyncio
async def test_caches_failed_fetches():
async def resolve(keys):
mapped_keys = [Exception("Error: {}".format(key)) for key in keys]
return mapped_keys
> error_loader, load_calls = id_loader(resolve=resolve)
graphene/utils/tests/test_dataloader.py:359:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/tests/test_dataloader.py:96: in id_loader
identity_loader = DataLoader(fn, **options)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
batch_load_fn = .fn at 0x7fe41c3fa340>, batch = None
max_batch_size = None, cache = None, get_cache_key = None, cache_map = None
loop = None
def __init__(self, batch_load_fn=None, batch=None, max_batch_size=None, cache=None, get_cache_key=None, cache_map=None, loop=None):
self._loop = loop
if batch_load_fn is not None:
self.batch_load_fn = batch_load_fn
> assert iscoroutinefunctionorpartial(self.batch_load_fn), 'batch_load_fn must be coroutine. Received: {}'.format(self.batch_load_fn)
E NameError: name 'iscoroutinefunctionorpartial' is not defined
graphene/utils/dataloader.py:17: NameError
test_dataloader.py::test_caches_failed_fetches_2
test_dataloader.py::test_caches_failed_fetches_2
@mark.asyncio
async def test_caches_failed_fetches_2():
> identity_loader, load_calls = id_loader()
graphene/utils/tests/test_dataloader.py:376:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/tests/test_dataloader.py:96: in id_loader
identity_loader = DataLoader(fn, **options)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
batch_load_fn = .fn at 0x7fe41c3f8540>, batch = None
max_batch_size = None, cache = None, get_cache_key = None, cache_map = None
loop = None
def __init__(self, batch_load_fn=None, batch=None, max_batch_size=None, cache=None, get_cache_key=None, cache_map=None, loop=None):
self._loop = loop
if batch_load_fn is not None:
self.batch_load_fn = batch_load_fn
> assert iscoroutinefunctionorpartial(self.batch_load_fn), 'batch_load_fn must be coroutine. Received: {}'.format(self.batch_load_fn)
E NameError: name 'iscoroutinefunctionorpartial' is not defined
graphene/utils/dataloader.py:17: NameError
test_dataloader.py::test_batches_loads_occuring_within_promises
test_dataloader.py::test_batches_loads_occuring_within_promises
@mark.asyncio
async def test_batches_loads_occuring_within_promises():
> identity_loader, load_calls = id_loader()
graphene/utils/tests/test_dataloader.py:389:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/tests/test_dataloader.py:96: in id_loader
identity_loader = DataLoader(fn, **options)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
batch_load_fn = .fn at 0x7fe41c3fb420>, batch = None
max_batch_size = None, cache = None, get_cache_key = None, cache_map = None
loop = None
def __init__(self, batch_load_fn=None, batch=None, max_batch_size=None, cache=None, get_cache_key=None, cache_map=None, loop=None):
self._loop = loop
if batch_load_fn is not None:
self.batch_load_fn = batch_load_fn
> assert iscoroutinefunctionorpartial(self.batch_load_fn), 'batch_load_fn must be coroutine. Received: {}'.format(self.batch_load_fn)
E NameError: name 'iscoroutinefunctionorpartial' is not defined
graphene/utils/dataloader.py:17: NameError
test_dataloader.py::test_catches_error_if_loader_resolver_fails
test_dataloader.py::test_catches_error_if_loader_resolver_fails
@mark.asyncio
async def test_catches_error_if_loader_resolver_fails():
exc = Exception("AOH!")
def do_resolve(x):
raise exc
> a_loader, a_load_calls = id_loader(resolve=do_resolve)
graphene/utils/tests/test_dataloader.py:411:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/tests/test_dataloader.py:96: in id_loader
identity_loader = DataLoader(fn, **options)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
batch_load_fn = .fn at 0x7fe41c3f93a0>, batch = None
max_batch_size = None, cache = None, get_cache_key = None, cache_map = None
loop = None
def __init__(self, batch_load_fn=None, batch=None, max_batch_size=None, cache=None, get_cache_key=None, cache_map=None, loop=None):
self._loop = loop
if batch_load_fn is not None:
self.batch_load_fn = batch_load_fn
> assert iscoroutinefunctionorpartial(self.batch_load_fn), 'batch_load_fn must be coroutine. Received: {}'.format(self.batch_load_fn)
E NameError: name 'iscoroutinefunctionorpartial' is not defined
graphene/utils/dataloader.py:17: NameError
test_dataloader.py::test_can_call_a_loader_from_a_loader
test_dataloader.py::test_can_call_a_loader_from_a_loader
@mark.asyncio
async def test_can_call_a_loader_from_a_loader():
> deep_loader, deep_load_calls = id_loader()
graphene/utils/tests/test_dataloader.py:421:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/tests/test_dataloader.py:96: in id_loader
identity_loader = DataLoader(fn, **options)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
batch_load_fn = .fn at 0x7fe41c3faac0>, batch = None
max_batch_size = None, cache = None, get_cache_key = None, cache_map = None
loop = None
def __init__(self, batch_load_fn=None, batch=None, max_batch_size=None, cache=None, get_cache_key=None, cache_map=None, loop=None):
self._loop = loop
if batch_load_fn is not None:
self.batch_load_fn = batch_load_fn
> assert iscoroutinefunctionorpartial(self.batch_load_fn), 'batch_load_fn must be coroutine. Received: {}'.format(self.batch_load_fn)
E NameError: name 'iscoroutinefunctionorpartial' is not defined
graphene/utils/dataloader.py:17: NameError
test_dataloader.py::test_dataloader_clear_with_missing_key_works
test_dataloader.py::test_dataloader_clear_with_missing_key_works
@mark.asyncio
async def test_dataloader_clear_with_missing_key_works():
async def do_resolve(x):
return x
> a_loader, a_load_calls = id_loader(resolve=do_resolve)
graphene/utils/tests/test_dataloader.py:451:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/utils/tests/test_dataloader.py:96: in id_loader
identity_loader = DataLoader(fn, **options)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
batch_load_fn = .fn at 0x7fe41c757420>, batch = None
max_batch_size = None, cache = None, get_cache_key = None, cache_map = None
loop = None
def __init__(self, batch_load_fn=None, batch=None, max_batch_size=None, cache=None, get_cache_key=None, cache_map=None, loop=None):
self._loop = loop
if batch_load_fn is not None:
self.batch_load_fn = batch_load_fn
> assert iscoroutinefunctionorpartial(self.batch_load_fn), 'batch_load_fn must be coroutine. Received: {}'.format(self.batch_load_fn)
E NameError: name 'iscoroutinefunctionorpartial' is not defined
graphene/utils/dataloader.py:17: NameError
test_deprecated.py::test_warn_deprecation
test_deprecated.py::test_warn_deprecation
self = , args = ('OH!',)
kwargs = {'category': , 'stacklevel': 2}
expected = call('OH!', stacklevel=2, category=)
actual = call('OH!', , stacklevel=2)
_error_message = ._error_message at 0x7fe41c585760>
cause = None
def assert_called_with(self, /, *args, **kwargs):
"""assert that the last call was made with the specified arguments.
Raises an AssertionError if the args and keyword args passed in are
different to the last call to the mock."""
if self.call_args is None:
expected = self._format_mock_call_signature(args, kwargs)
actual = 'not called.'
error_message = ('expected call not found.\nExpected: %s\n Actual: %s'
% (expected, actual))
raise AssertionError(error_message)
def _error_message():
msg = self._format_mock_failure_message(args, kwargs)
return msg
expected = self._call_matcher(_Call((args, kwargs), two=True))
actual = self._call_matcher(self.call_args)
if actual != expected:
cause = expected if isinstance(expected, Exception) else None
> raise AssertionError(_error_message()) from cause
E AssertionError: expected call not found.
E Expected: warn('OH!', stacklevel=2, category=)
E Actual: warn('OH!', , stacklevel=2)
/root/.local/share/uv/python/cpython-3.11.10-linux-x86_64-gnu/lib/python3.11/unittest/mock.py:939: AssertionError
During handling of the above exception, another exception occurred:
mocker =
def test_warn_deprecation(mocker):
mocker.patch.object(deprecated.warnings, "warn")
warn_deprecation("OH!")
> deprecated.warnings.warn.assert_called_with(
"OH!", stacklevel=2, category=DeprecationWarning
)
E AssertionError: expected call not found.
E Expected: warn('OH!', stacklevel=2, category=)
E Actual: warn('OH!', , stacklevel=2)
E
E pytest introspection follows:
E
E Args:
E assert ('OH!', ) == ('OH!',)
E
E Left contains one more item:
E Use -v to get more diff
E Kwargs:
E assert {'stacklevel': 2} == {'category': ...tacklevel': 2}
E
E Omitting 1 identical items, use -vv to show
E Right contains 1 more item:
E {'category': }
E Use -v to get more diff
graphene/utils/tests/test_deprecated.py:12: AssertionError
test_deprecated.py::test_deprecated_decorator
test_deprecated.py::test_deprecated_decorator
self =
args = ('Call to deprecated function my_func.',), kwargs = {}
expected = call('Call to deprecated function my_func.')
actual = call('my_func is deprecated.')
_error_message = ._error_message at 0x7fe41c756b60>
cause = None
def assert_called_with(self, /, *args, **kwargs):
"""assert that the last call was made with the specified arguments.
Raises an AssertionError if the args and keyword args passed in are
different to the last call to the mock."""
if self.call_args is None:
expected = self._format_mock_call_signature(args, kwargs)
actual = 'not called.'
error_message = ('expected call not found.\nExpected: %s\n Actual: %s'
% (expected, actual))
raise AssertionError(error_message)
def _error_message():
msg = self._format_mock_failure_message(args, kwargs)
return msg
expected = self._call_matcher(_Call((args, kwargs), two=True))
actual = self._call_matcher(self.call_args)
if actual != expected:
cause = expected if isinstance(expected, Exception) else None
> raise AssertionError(_error_message()) from cause
E AssertionError: expected call not found.
E Expected: warn_deprecation('Call to deprecated function my_func.')
E Actual: warn_deprecation('my_func is deprecated.')
/root/.local/share/uv/python/cpython-3.11.10-linux-x86_64-gnu/lib/python3.11/unittest/mock.py:939: AssertionError
During handling of the above exception, another exception occurred:
mocker =
def test_deprecated_decorator(mocker):
mocker.patch.object(deprecated, "warn_deprecation")
@deprecated_decorator
def my_func():
return True
result = my_func()
assert result
> deprecated.warn_deprecation.assert_called_with(
"Call to deprecated function my_func."
)
E AssertionError: expected call not found.
E Expected: warn_deprecation('Call to deprecated function my_func.')
E Actual: warn_deprecation('my_func is deprecated.')
E
E pytest introspection follows:
E
E Args:
E assert ('my_func is deprecated.',) == ('Call to dep...on my_func.',)
E
E At index 0 diff: 'my_func is deprecated.' != 'Call to deprecated function my_func.'
E Use -v to get more diff
graphene/utils/tests/test_deprecated.py:26: AssertionError
test_deprecated.py::test_deprecated_class
test_deprecated.py::test_deprecated_class
self =
args = ('Call to deprecated class X.',), kwargs = {}
expected = call('Call to deprecated class X.')
actual = call('X is deprecated.')
_error_message = ._error_message at 0x7fe41c70ec00>
cause = None
def assert_called_with(self, /, *args, **kwargs):
"""assert that the last call was made with the specified arguments.
Raises an AssertionError if the args and keyword args passed in are
different to the last call to the mock."""
if self.call_args is None:
expected = self._format_mock_call_signature(args, kwargs)
actual = 'not called.'
error_message = ('expected call not found.\nExpected: %s\n Actual: %s'
% (expected, actual))
raise AssertionError(error_message)
def _error_message():
msg = self._format_mock_failure_message(args, kwargs)
return msg
expected = self._call_matcher(_Call((args, kwargs), two=True))
actual = self._call_matcher(self.call_args)
if actual != expected:
cause = expected if isinstance(expected, Exception) else None
> raise AssertionError(_error_message()) from cause
E AssertionError: expected call not found.
E Expected: warn_deprecation('Call to deprecated class X.')
E Actual: warn_deprecation('X is deprecated.')
/root/.local/share/uv/python/cpython-3.11.10-linux-x86_64-gnu/lib/python3.11/unittest/mock.py:939: AssertionError
During handling of the above exception, another exception occurred:
mocker =
def test_deprecated_class(mocker):
mocker.patch.object(deprecated, "warn_deprecation")
@deprecated_decorator
class X:
pass
result = X()
assert result
> deprecated.warn_deprecation.assert_called_with("Call to deprecated class X.")
E AssertionError: expected call not found.
E Expected: warn_deprecation('Call to deprecated class X.')
E Actual: warn_deprecation('X is deprecated.')
E
E pytest introspection follows:
E
E Args:
E assert ('X is deprecated.',) == ('Call to dep...ed class X.',)
E
E At index 0 diff: 'X is deprecated.' != 'Call to deprecated class X.'
E Use -v to get more diff
graphene/utils/tests/test_deprecated.py:40: AssertionError
test_deprecated.py::test_deprecated_decorator_text
test_deprecated.py::test_deprecated_decorator_text
self =
args = ('Call to deprecated function my_func (Deprecation text).',), kwargs = {}
expected = call('Call to deprecated function my_func (Deprecation text).')
actual = call('my_func function is deprecated. Deprecation text')
_error_message = ._error_message at 0x7fe41c6b6200>
cause = None
def assert_called_with(self, /, *args, **kwargs):
"""assert that the last call was made with the specified arguments.
Raises an AssertionError if the args and keyword args passed in are
different to the last call to the mock."""
if self.call_args is None:
expected = self._format_mock_call_signature(args, kwargs)
actual = 'not called.'
error_message = ('expected call not found.\nExpected: %s\n Actual: %s'
% (expected, actual))
raise AssertionError(error_message)
def _error_message():
msg = self._format_mock_failure_message(args, kwargs)
return msg
expected = self._call_matcher(_Call((args, kwargs), two=True))
actual = self._call_matcher(self.call_args)
if actual != expected:
cause = expected if isinstance(expected, Exception) else None
> raise AssertionError(_error_message()) from cause
E AssertionError: expected call not found.
E Expected: warn_deprecation('Call to deprecated function my_func (Deprecation text).')
E Actual: warn_deprecation('my_func function is deprecated. Deprecation text')
/root/.local/share/uv/python/cpython-3.11.10-linux-x86_64-gnu/lib/python3.11/unittest/mock.py:939: AssertionError
During handling of the above exception, another exception occurred:
mocker =
def test_deprecated_decorator_text(mocker):
mocker.patch.object(deprecated, "warn_deprecation")
@deprecated_decorator("Deprecation text")
def my_func():
return True
result = my_func()
assert result
> deprecated.warn_deprecation.assert_called_with(
"Call to deprecated function my_func (Deprecation text)."
)
E AssertionError: expected call not found.
E Expected: warn_deprecation('Call to deprecated function my_func (Deprecation text).')
E Actual: warn_deprecation('my_func function is deprecated. Deprecation text')
E
E pytest introspection follows:
E
E Args:
E assert ('my_func fun...cation text',) == ('Call to dep...tion text).',)
E
E At index 0 diff: 'my_func function is deprecated. Deprecation text' != 'Call to deprecated function my_func (Deprecation text).'
E Use -v to get more diff
graphene/utils/tests/test_deprecated.py:52: AssertionError
test_deprecated.py::test_deprecated_class_text
test_deprecated.py::test_deprecated_class_text
self =
args = ('Call to deprecated class X (Deprecation text).',), kwargs = {}
expected = call('Call to deprecated class X (Deprecation text).')
actual = call('X class is deprecated. Deprecation text')
_error_message = ._error_message at 0x7fe41c70fa60>
cause = None
def assert_called_with(self, /, *args, **kwargs):
"""assert that the last call was made with the specified arguments.
Raises an AssertionError if the args and keyword args passed in are
different to the last call to the mock."""
if self.call_args is None:
expected = self._format_mock_call_signature(args, kwargs)
actual = 'not called.'
error_message = ('expected call not found.\nExpected: %s\n Actual: %s'
% (expected, actual))
raise AssertionError(error_message)
def _error_message():
msg = self._format_mock_failure_message(args, kwargs)
return msg
expected = self._call_matcher(_Call((args, kwargs), two=True))
actual = self._call_matcher(self.call_args)
if actual != expected:
cause = expected if isinstance(expected, Exception) else None
> raise AssertionError(_error_message()) from cause
E AssertionError: expected call not found.
E Expected: warn_deprecation('Call to deprecated class X (Deprecation text).')
E Actual: warn_deprecation('X class is deprecated. Deprecation text')
/root/.local/share/uv/python/cpython-3.11.10-linux-x86_64-gnu/lib/python3.11/unittest/mock.py:939: AssertionError
During handling of the above exception, another exception occurred:
mocker =
def test_deprecated_class_text(mocker):
mocker.patch.object(deprecated, "warn_deprecation")
@deprecated_decorator("Deprecation text")
class X:
pass
result = X()
assert result
> deprecated.warn_deprecation.assert_called_with(
"Call to deprecated class X (Deprecation text)."
)
E AssertionError: expected call not found.
E Expected: warn_deprecation('Call to deprecated class X (Deprecation text).')
E Actual: warn_deprecation('X class is deprecated. Deprecation text')
E
E pytest introspection follows:
E
E Args:
E assert ('X class is ...cation text',) == ('Call to dep...tion text).',)
E
E At index 0 diff: 'X class is deprecated. Deprecation text' != 'Call to deprecated class X (Deprecation text).'
E Use -v to get more diff
graphene/utils/tests/test_deprecated.py:66: AssertionError
test_module_loading.py::test_import_string_attributes
test_module_loading.py::test_import_string_attributes
def test_import_string_attributes():
with raises(Exception) as exc_info:
import_string("graphene.String", "length")
> assert (
str(exc_info.value)
== 'Module "graphene" does not define a "length" attribute inside attribute/class '
'"String"'
)
E assert 'Object "Stri...bute "length"' == 'Module "grap...lass "String"'
E
E - Module "graphene" does not define a "length" attribute inside attribute/class "String"
E + Object "String" does not have attribute "length"
graphene/utils/tests/test_module_loading.py:37: AssertionError
test_orderedtype.py::test_orderedtype_resetcounter
test_orderedtype.py::test_orderedtype_resetcounter
def test_orderedtype_resetcounter():
one = OrderedType()
two = OrderedType()
> one.reset_counter()
E AttributeError: 'OrderedType' object has no attribute 'reset_counter'
graphene/utils/tests/test_orderedtype.py:31: AttributeError
test_str_converters.py::test_snake_case
test_str_converters.py::test_snake_case
def test_snake_case():
assert to_snake_case("snakesOnAPlane") == "snakes_on_a_plane"
assert to_snake_case("SnakesOnAPlane") == "snakes_on_a_plane"
> assert to_snake_case("SnakesOnA_Plane") == "snakes_on_a__plane"
E AssertionError: assert 'snakes_on_a_plane' == 'snakes_on_a__plane'
E
E - snakes_on_a__plane
E ? -
E + snakes_on_a_plane
graphene/utils/tests/test_str_converters.py:8: AssertionError
Patch diff
diff --git a/graphene/relay/connection.py b/graphene/relay/connection.py
index 230c1a7..347a68b 100644
--- a/graphene/relay/connection.py
+++ b/graphene/relay/connection.py
@@ -18,9 +18,26 @@ class PageInfo(ObjectType):
start_cursor = String(name='startCursor', description='When paginating backwards, the cursor to continue.')
end_cursor = String(name='endCursor', description='When paginating forwards, the cursor to continue.')
+def get_edge_class(connection_class, node_class, base_name, strict_types=False):
+ """Create an Edge class for a Connection."""
+ class EdgeBase(ObjectType):
+ class Meta:
+ name = f'{base_name}Edge'
+ description = 'A Relay edge containing a `{base_name}` and its cursor.'
+
+ node = Field(NonNull(node_class) if strict_types else node_class, description='The item at the end of the edge.')
+ cursor = String(required=True, description='A cursor for use in pagination.')
+
+ return type(EdgeBase.__name__, (EdgeBase,), {})
+
def page_info_adapter(startCursor, endCursor, hasPreviousPage, hasNextPage):
"""Adapter for creating PageInfo instances"""
- pass
+ return PageInfo(
+ start_cursor=startCursor,
+ end_cursor=endCursor,
+ has_previous_page=hasPreviousPage,
+ has_next_page=hasNextPage
+ )
class ConnectionOptions(ObjectTypeOptions):
node = None
@@ -53,7 +70,7 @@ class Connection(ObjectType):
def connection_adapter(cls, edges, pageInfo):
"""Adapter for creating Connection instances"""
- pass
+ return cls(edges=edges, page_info=pageInfo)
class IterableConnectionField(Field):
diff --git a/graphene/relay/node.py b/graphene/relay/node.py
index ed065ff..64b732b 100644
--- a/graphene/relay/node.py
+++ b/graphene/relay/node.py
@@ -9,7 +9,11 @@ def is_node(objecttype):
"""
Check if the given objecttype has Node as an interface
"""
- pass
+ if not isclass(objecttype):
+ return False
+ if not issubclass(objecttype, ObjectType):
+ return False
+ return Node in objecttype._meta.interfaces
class GlobalID(Field):
@@ -41,4 +45,9 @@ class AbstractNode(Interface):
super(AbstractNode, cls).__init_subclass_with_meta__(_meta=_meta, **options)
class Node(AbstractNode):
- """An object with an ID"""
\ No newline at end of file
+ """An object with an ID"""
+
+ @classmethod
+ def Field(cls, *args, **kwargs):
+ """Create a NodeField for this Node class."""
+ return NodeField(cls, *args, **kwargs)
\ No newline at end of file
diff --git a/graphene/types/argument.py b/graphene/types/argument.py
index 3d5d873..7da0431 100644
--- a/graphene/types/argument.py
+++ b/graphene/types/argument.py
@@ -5,6 +5,28 @@ from .mountedtype import MountedType
from .structures import NonNull
from .utils import get_type
+def to_arguments(args, extra_args=None):
+ """
+ Convert arguments to a list of Argument instances.
+ """
+ from .unmountedtype import UnmountedType
+
+ extra_args = extra_args or {}
+ arguments = []
+
+ for name, value in chain(args.items(), extra_args.items()):
+ if isinstance(value, Argument):
+ argument = value
+ if argument.name is None:
+ argument.name = name
+ elif isinstance(value, (UnmountedType, Dynamic)):
+ argument = Argument(value, name=name)
+ else:
+ raise ValueError(f'Unknown argument "{name}" of type {type(value)}')
+ arguments.append(argument)
+
+ return sorted(arguments, key=lambda x: x.creation_counter)
+
class Argument(MountedType):
"""
Makes an Argument available on a Field in the GraphQL schema.
diff --git a/graphene/types/base.py b/graphene/types/base.py
index 03c7007..5c5dc69 100644
--- a/graphene/types/base.py
+++ b/graphene/types/base.py
@@ -18,6 +18,11 @@ class BaseOptions:
def __repr__(self):
return f'<{self.__class__.__name__} name={repr(self.name)}>'
+
+ def freeze(self):
+ """Freeze the options to prevent further modifications."""
+ self._frozen = True
+
BaseTypeMeta = SubclassWithMeta_Meta
class BaseType(SubclassWithMeta):
diff --git a/graphene/types/enum.py b/graphene/types/enum.py
index ff69925..97d833d 100644
--- a/graphene/types/enum.py
+++ b/graphene/types/enum.py
@@ -4,6 +4,16 @@ from .base import BaseOptions, BaseType
from .unmountedtype import UnmountedType
EnumType = type(PyEnum)
+def eq_enum(self, other):
+ """Compare two enum values for equality."""
+ if isinstance(other, self.__class__):
+ return self.value == other.value
+ return self.value == other
+
+def hash_enum(self):
+ """Hash an enum value."""
+ return hash(self.value)
+
class EnumOptions(BaseOptions):
enum = None
deprecation_reason = None
@@ -75,4 +85,15 @@ class Enum(UnmountedType, BaseType, metaclass=EnumMeta):
This function is called when the unmounted type (Enum instance)
is mounted (as a Field, InputField or Argument)
"""
- pass
\ No newline at end of file
+ return cls
+
+ @classmethod
+ def from_enum(cls, enum, description=None, deprecation_reason=None):
+ """Create a Graphene Enum from a Python enum.py Enum."""
+ meta_dict = {
+ 'enum': enum,
+ 'description': description,
+ 'deprecation_reason': deprecation_reason
+ }
+ meta_class = type('Meta', (object,), meta_dict)
+ return type(meta_class.enum.__name__, (cls,), {'Meta': meta_class})
\ No newline at end of file
diff --git a/graphene/types/generic.py b/graphene/types/generic.py
index 601d6c7..8d1d283 100644
--- a/graphene/types/generic.py
+++ b/graphene/types/generic.py
@@ -3,6 +3,10 @@ from graphql.language.ast import BooleanValueNode, FloatValueNode, IntValueNode,
from graphene.types.scalars import MAX_INT, MIN_INT
from .scalars import Scalar
+def identity(value):
+ """Return the value unchanged."""
+ return value
+
class GenericScalar(Scalar):
"""
The `GenericScalar` scalar type represents a generic
diff --git a/graphene/types/resolver.py b/graphene/types/resolver.py
index aed4dfb..150d851 100644
--- a/graphene/types/resolver.py
+++ b/graphene/types/resolver.py
@@ -1 +1,16 @@
-default_resolver = dict_or_attr_resolver
\ No newline at end of file
+def dict_or_attr_resolver(attname, default_value, root, info, **args):
+ """
+ Default resolver that tries to get the value from:
+ 1. The root dict (if root is a dict)
+ 2. An attribute of root
+ 3. Default value if nothing is found
+ """
+ if isinstance(root, dict):
+ return root.get(attname, default_value)
+ return getattr(root, attname, default_value)
+
+default_resolver = dict_or_attr_resolver
+
+def get_default_resolver():
+ """Get the default resolver function."""
+ return default_resolver
\ No newline at end of file
diff --git a/graphene/types/scalars.py b/graphene/types/scalars.py
index d42a1ab..51180d5 100644
--- a/graphene/types/scalars.py
+++ b/graphene/types/scalars.py
@@ -1,11 +1,42 @@
-from typing import Any
+from typing import Any, Optional, Union
from graphql import Undefined
from graphql.language.ast import BooleanValueNode, FloatValueNode, IntValueNode, StringValueNode
from .base import BaseOptions, BaseType
from .unmountedtype import UnmountedType
+MAX_INT = 2147483647
+MIN_INT = -2147483648
+
+def coerce_int(value: Any) -> Optional[int]:
+ """Convert a value to an integer if possible."""
+ if value is None or value is Undefined:
+ return None
+ try:
+ num = int(value)
+ if num > MAX_INT or num < MIN_INT:
+ return None
+ return num
+ except (TypeError, ValueError):
+ return None
+
+def coerce_float(value: Any) -> Optional[float]:
+ """Convert a value to a float if possible."""
+ if value is None or value is Undefined:
+ return None
+ try:
+ return float(value)
+ except (TypeError, ValueError):
+ return None
+
+def coerce_string(value: Any) -> Optional[str]:
+ """Convert a value to a string if possible."""
+ if value is None or value is Undefined:
+ return None
+ return str(value)
+
class ScalarOptions(BaseOptions):
- pass
+ def freeze(self):
+ self._frozen = True
class Scalar(UnmountedType, BaseType):
"""
@@ -30,9 +61,12 @@ class Scalar(UnmountedType, BaseType):
This function is called when the unmounted type (Scalar instance)
is mounted (as a Field, InputField or Argument)
"""
- pass
-MAX_INT = 2147483647
-MIN_INT = -2147483648
+ return cls
+
+ def mount(self, _as=None):
+ """Mount the scalar type as a Field."""
+ from .field import Field
+ return Field(self.get_type(), *self.args, **self.kwargs)
class Int(Scalar):
"""
@@ -44,6 +78,12 @@ class Int(Scalar):
serialize = coerce_int
parse_value = coerce_int
+ @staticmethod
+ def parse_literal(ast):
+ if isinstance(ast, IntValueNode):
+ return coerce_int(ast.value)
+ return None
+
class BigInt(Scalar):
"""
The `BigInt` scalar type represents non-fractional whole numeric values.
@@ -53,6 +93,12 @@ class BigInt(Scalar):
serialize = coerce_int
parse_value = coerce_int
+ @staticmethod
+ def parse_literal(ast):
+ if isinstance(ast, IntValueNode):
+ return coerce_int(ast.value)
+ return None
+
class Float(Scalar):
"""
The `Float` scalar type represents signed double-precision fractional
@@ -62,6 +108,12 @@ class Float(Scalar):
serialize = coerce_float
parse_value = coerce_float
+ @staticmethod
+ def parse_literal(ast):
+ if isinstance(ast, (IntValueNode, FloatValueNode)):
+ return coerce_float(ast.value)
+ return None
+
class String(Scalar):
"""
The `String` scalar type represents textual data, represented as UTF-8
@@ -71,6 +123,12 @@ class String(Scalar):
serialize = coerce_string
parse_value = coerce_string
+ @staticmethod
+ def parse_literal(ast):
+ if isinstance(ast, StringValueNode):
+ return ast.value
+ return None
+
class Boolean(Scalar):
"""
The `Boolean` scalar type represents `true` or `false`.
@@ -78,6 +136,12 @@ class Boolean(Scalar):
serialize = bool
parse_value = bool
+ @staticmethod
+ def parse_literal(ast):
+ if isinstance(ast, BooleanValueNode):
+ return ast.value
+ return None
+
class ID(Scalar):
"""
The `ID` scalar type represents a unique identifier, often used to
@@ -87,4 +151,10 @@ class ID(Scalar):
(such as `4`) input value will be accepted as an ID.
"""
serialize = str
- parse_value = str
\ No newline at end of file
+ parse_value = str
+
+ @staticmethod
+ def parse_literal(ast):
+ if isinstance(ast, (StringValueNode, IntValueNode)):
+ return str(ast.value)
+ return None
\ No newline at end of file
diff --git a/graphene/types/schema.py b/graphene/types/schema.py
index ed0c560..1d38b1e 100644
--- a/graphene/types/schema.py
+++ b/graphene/types/schema.py
@@ -16,9 +16,26 @@ from .scalars import ID, Boolean, Float, Int, Scalar, String
from .structures import List, NonNull
from .union import Union
from .utils import get_field_as
+
introspection_query = get_introspection_query()
IntrospectionSchema = introspection_types['__Schema']
+def is_graphene_type(type_):
+ """Check if the given type is a Graphene type."""
+ if isinstance(type_, (GrapheneGraphQLType, str)):
+ return True
+ if inspect.isclass(type_) and issubclass(type_, (ObjectType, InputObjectType, Scalar, Interface, Union, Enum)):
+ return True
+ return False
+
+def assert_valid_root_type(type_):
+ """Assert that the given type is a valid root type."""
+ if type_ is None:
+ return
+ is_valid = inspect.isclass(type_) and issubclass(type_, ObjectType)
+ if not is_valid:
+ raise Exception(f'Type "{type_}" is not a valid root type. Expected a subclass of ObjectType.')
+
class TypeMap(dict):
def __init__(self, query=None, mutation=None, subscription=None, types=None, auto_camelcase=True):
@@ -38,7 +55,12 @@ class TypeMap(dict):
def get_function_for_type(self, graphene_type, func_name, name, default_value):
"""Gets a resolve or subscribe function for a given ObjectType"""
- pass
+ if not hasattr(graphene_type, func_name):
+ return default_value
+ func = getattr(graphene_type, func_name)
+ if func is None:
+ return default_value
+ return func
class Schema:
"""Schema Definition.
@@ -108,18 +130,27 @@ class Schema:
Returns:
:obj:`ExecutionResult` containing any data and errors for the operation.
"""
- pass
+ kwargs = normalize_execute_kwargs(kwargs)
+ return graphql_sync(self.graphql_schema, *args, **kwargs)
async def execute_async(self, *args, **kwargs):
"""Execute a GraphQL query on the schema asynchronously.
Same as `execute`, but uses `graphql` instead of `graphql_sync`.
"""
- pass
+ kwargs = normalize_execute_kwargs(kwargs)
+ return await graphql(self.graphql_schema, *args, **kwargs)
async def subscribe(self, query, *args, **kwargs):
"""Execute a GraphQL subscription on the schema asynchronously."""
- pass
+ kwargs = normalize_execute_kwargs(kwargs)
+ return await subscribe(self.graphql_schema, query, *args, **kwargs)
def normalize_execute_kwargs(kwargs):
"""Replace alias names in keyword arguments for graphql()"""
- pass
\ No newline at end of file
+ if kwargs.get('root') is not None and not kwargs.get('root_value'):
+ kwargs['root_value'] = kwargs.pop('root')
+ if kwargs.get('context') is not None and not kwargs.get('context_value'):
+ kwargs['context_value'] = kwargs.pop('context')
+ if kwargs.get('variables') is not None and not kwargs.get('variable_values'):
+ kwargs['variable_values'] = kwargs.pop('variables')
+ return kwargs
\ No newline at end of file
diff --git a/graphene/types/structures.py b/graphene/types/structures.py
index fa4a743..07dcab1 100644
--- a/graphene/types/structures.py
+++ b/graphene/types/structures.py
@@ -20,7 +20,12 @@ class Structure(UnmountedType):
This function is called when the unmounted type (List or NonNull instance)
is mounted (as a Field, InputField or Argument)
"""
- pass
+ return get_type(self._of_type)
+
+ def mount(self, _as=None):
+ """Mount the structure type as a Field."""
+ from .field import Field
+ return Field(self.get_type(), *self.args, **self.kwargs)
class List(Structure):
"""
diff --git a/graphene/types/utils.py b/graphene/types/utils.py
index 9c05994..e7bc059 100644
--- a/graphene/types/utils.py
+++ b/graphene/types/utils.py
@@ -4,19 +4,49 @@ from ..utils.module_loading import import_string
from .mountedtype import MountedType
from .unmountedtype import UnmountedType
+def get_type(type_):
+ """
+ Returns the type for the given type. It can be:
+ - A MountedType (which will be returned as is)
+ - A UnmountedType (which will be mounted)
+ - A Type string (which will be imported and mounted)
+ - A callable (which will be called and mounted)
+ """
+ if isinstance(type_, MountedType):
+ return type_
+ elif isinstance(type_, UnmountedType):
+ return type_.mount()
+ elif isinstance(type_, str):
+ return import_string(type_)
+ elif callable(type_):
+ return get_type(type_())
+ return type_
+
def get_field_as(value, _as=None):
"""
Get type mounted
"""
- pass
+ if isinstance(value, MountedType):
+ return value
+ elif isinstance(value, UnmountedType):
+ return value.mount(_as)
+ return value
def yank_fields_from_attrs(attrs, _as=None, sort=True):
"""
Extract all the fields in given attributes (dict)
and return them ordered
"""
- pass
+ fields = []
+ for key, value in attrs.items():
+ if isinstance(value, (MountedType, UnmountedType)):
+ fields.append((key, get_field_as(value, _as)))
+ if sort:
+ fields = sorted(fields, key=lambda f: f[1].creation_counter)
+ return fields
def get_underlying_type(_type):
"""Get the underlying type even if it is wrapped in structures like NonNull"""
- pass
\ No newline at end of file
+ while hasattr(_type, 'of_type'):
+ _type = _type.of_type
+ return _type
\ No newline at end of file
diff --git a/graphene/utils/crunch.py b/graphene/utils/crunch.py
index 0ff4a3a..d97f292 100644
--- a/graphene/utils/crunch.py
+++ b/graphene/utils/crunch.py
@@ -1,2 +1,69 @@
import json
-from collections.abc import Mapping
\ No newline at end of file
+from collections.abc import Mapping
+
+def crunch(data):
+ """
+ Transforms data structures into a more compact form by:
+ - Converting primitives into single-item lists
+ - Converting arrays into a list of values followed by indices
+ - Converting objects into a list of values followed by a key-index mapping
+ """
+ values = []
+ value_to_index = {}
+
+ def get_index(value):
+ if not isinstance(value, (bool, int, float, str, type(None))):
+ value = json.dumps(value, sort_keys=True)
+ if value not in value_to_index:
+ value_to_index[value] = len(values)
+ values.append(value)
+ return value_to_index[value]
+
+ def process(obj):
+ if isinstance(obj, (bool, int, float, str, type(None))):
+ return [obj]
+ elif isinstance(obj, list):
+ if not obj:
+ return [[]]
+ indices = []
+ for item in obj:
+ processed = process(item)
+ if len(processed) > 1:
+ indices.append(get_index(processed))
+ else:
+ indices.append(get_index(processed[0]))
+ result = []
+ for i in range(len(values)):
+ if isinstance(values[i], str) and values[i].startswith('['):
+ try:
+ array = json.loads(values[i])
+ if array == indices:
+ return values[:i] + [indices]
+ except:
+ pass
+ values.append(json.dumps(indices))
+ return values
+ elif isinstance(obj, Mapping):
+ if not obj:
+ return [{}]
+ obj_indices = {}
+ for key, value in sorted(obj.items()):
+ processed = process(value)
+ if len(processed) > 1:
+ obj_indices[key] = get_index(processed)
+ else:
+ obj_indices[key] = get_index(processed[0])
+ result = []
+ for i in range(len(values)):
+ if isinstance(values[i], str) and values[i].startswith('{'):
+ try:
+ mapping = json.loads(values[i])
+ if mapping == obj_indices:
+ return values[:i] + [obj_indices]
+ except:
+ pass
+ values.append(json.dumps(obj_indices))
+ return values
+ return [obj]
+
+ return process(data)
\ No newline at end of file
diff --git a/graphene/utils/deprecated.py b/graphene/utils/deprecated.py
index a3e7408..71b0164 100644
--- a/graphene/utils/deprecated.py
+++ b/graphene/utils/deprecated.py
@@ -3,10 +3,38 @@ import inspect
import warnings
string_types = (type(b''), type(''))
+def warn_deprecation(message):
+ warnings.warn(message, DeprecationWarning, stacklevel=2)
+
def deprecated(reason):
"""
This is a decorator which can be used to mark functions
as deprecated. It will result in a warning being emitted
when the function is used.
"""
- pass
\ No newline at end of file
+ if isinstance(reason, string_types):
+ def decorator(func):
+ if inspect.isclass(func):
+ fmt = "{name} class is deprecated. {reason}"
+ else:
+ fmt = "{name} function is deprecated. {reason}"
+
+ msg = fmt.format(name=func.__name__, reason=reason)
+
+ @functools.wraps(func)
+ def wrapper(*args, **kwargs):
+ warn_deprecation(msg)
+ return func(*args, **kwargs)
+ return wrapper
+ return decorator
+ elif inspect.isclass(reason) or inspect.isfunction(reason):
+ func = reason
+ msg = "{} is deprecated.".format(func.__name__)
+
+ @functools.wraps(func)
+ def wrapper(*args, **kwargs):
+ warn_deprecation(msg)
+ return func(*args, **kwargs)
+ return wrapper
+ else:
+ raise TypeError(repr(type(reason)))
\ No newline at end of file
diff --git a/graphene/utils/get_unbound_function.py b/graphene/utils/get_unbound_function.py
index e69de29..4e0b838 100644
--- a/graphene/utils/get_unbound_function.py
+++ b/graphene/utils/get_unbound_function.py
@@ -0,0 +1,9 @@
+def get_unbound_function(func):
+ """
+ Get the unbound function from a bound method or function.
+ This is useful when we want to get the original function from a method
+ that has been bound to a class instance.
+ """
+ if hasattr(func, "__func__"):
+ return func.__func__
+ return func
diff --git a/graphene/utils/module_loading.py b/graphene/utils/module_loading.py
index fd365ca..89e734c 100644
--- a/graphene/utils/module_loading.py
+++ b/graphene/utils/module_loading.py
@@ -9,4 +9,33 @@ def import_string(dotted_path, dotted_attributes=None):
the first step, and return the corresponding value designated by the
attribute path. Raise ImportError if the import failed.
"""
- pass
\ No newline at end of file
+ try:
+ module_path, class_name = dotted_path.rsplit('.', 1)
+ except ValueError as err:
+ raise ImportError("%s doesn't look like a module path" % dotted_path) from err
+
+ try:
+ module = import_module(module_path)
+ except ImportError as err:
+ raise ImportError('Module "%s" does not exist' % module_path) from err
+
+ try:
+ attribute = getattr(module, class_name)
+ except AttributeError as err:
+ raise ImportError('Module "%s" does not define a "%s" attribute/class' % (module_path, class_name)) from err
+
+ if dotted_attributes:
+ try:
+ for attr in dotted_attributes.split('.'):
+ attribute = getattr(attribute, attr)
+ except AttributeError as err:
+ raise ImportError('Object "%s" does not have attribute "%s"' % (attribute, dotted_attributes)) from err
+
+ return attribute
+
+def lazy_import(dotted_path, dotted_attributes=None):
+ """
+ Lazy version of import_string that returns a proxy object that imports the module
+ only when needed.
+ """
+ return partial(import_string, dotted_path, dotted_attributes)
\ No newline at end of file
diff --git a/graphene/utils/orderedtype.py b/graphene/utils/orderedtype.py
index 6776272..76666e0 100644
--- a/graphene/utils/orderedtype.py
+++ b/graphene/utils/orderedtype.py
@@ -7,6 +7,13 @@ class OrderedType:
def __init__(self, _creation_counter=None):
self.creation_counter = _creation_counter or self.gen_counter()
+ @classmethod
+ def gen_counter(cls):
+ """Generate a new counter value."""
+ counter = cls.creation_counter
+ cls.creation_counter += 1
+ return counter
+
def __eq__(self, other):
if isinstance(self, type(other)):
return self.creation_counter == other.creation_counter
diff --git a/graphene/utils/props.py b/graphene/utils/props.py
index ec56be0..c44e9ed 100644
--- a/graphene/utils/props.py
+++ b/graphene/utils/props.py
@@ -3,4 +3,22 @@ class _OldClass:
class _NewClass:
pass
-_all_vars = set(dir(_OldClass) + dir(_NewClass))
\ No newline at end of file
+_all_vars = set(dir(_OldClass) + dir(_NewClass))
+
+def props(obj):
+ """
+ Extract all properties from a class or instance.
+ Properties are attributes that are not in the base class.
+ """
+ if isinstance(obj, type):
+ # If obj is a class, get its attributes
+ attrs = obj.__dict__
+ else:
+ # If obj is an instance, get its class's attributes
+ attrs = obj.__class__.__dict__
+
+ return {
+ key: value
+ for key, value in attrs.items()
+ if key not in _all_vars and not key.startswith('_')
+ }
\ No newline at end of file
diff --git a/graphene/utils/resolve_only_args.py b/graphene/utils/resolve_only_args.py
index 202d774..1133f4a 100644
--- a/graphene/utils/resolve_only_args.py
+++ b/graphene/utils/resolve_only_args.py
@@ -1,2 +1,13 @@
from functools import wraps
-from .deprecated import deprecated
\ No newline at end of file
+from .deprecated import deprecated
+
+@deprecated('resolve_only_args decorator is deprecated. Use normal resolver function instead.')
+def resolve_only_args(resolver):
+ """
+ This function wraps a resolver to only pass root and args,
+ disregarding info and context (info=None).
+ """
+ @wraps(resolver)
+ def wrapped_resolver(root, info, **args):
+ return resolver(root, **args)
+ return wrapped_resolver
\ No newline at end of file
diff --git a/graphene/utils/str_converters.py b/graphene/utils/str_converters.py
index 7d0e67b..9b581b7 100644
--- a/graphene/utils/str_converters.py
+++ b/graphene/utils/str_converters.py
@@ -1 +1,15 @@
-import re
\ No newline at end of file
+import re
+
+def to_camel_case(snake_str):
+ """Convert a snake_case string to camelCase."""
+ components = snake_str.split('_')
+ # We capitalize the first letter of each component except the first one
+ # with the 'capitalize' method and join them together.
+ return components[0] + ''.join(x.capitalize() if x else '_' for x in components[1:])
+
+def to_snake_case(camel_str):
+ """Convert a camelCase string to snake_case."""
+ pattern = re.compile(r'(?<!^)(?<!_)([A-Z])')
+ # Insert underscore before capital letters (except at start or after underscore)
+ # and convert to lowercase
+ return pattern.sub(r'_\1', camel_str).lower()
\ No newline at end of file
diff --git a/graphene/utils/subclass_with_meta.py b/graphene/utils/subclass_with_meta.py
index bde17f5..b08c0d0 100644
--- a/graphene/utils/subclass_with_meta.py
+++ b/graphene/utils/subclass_with_meta.py
@@ -30,7 +30,7 @@ class SubclassWithMeta(metaclass=SubclassWithMeta_Meta):
options = dict(meta_options, **_meta_props)
abstract = options.pop('abstract', False)
if abstract:
- assert not options, f'Abstract types can only contain the abstract attribute. Received: abstract, {', '.join(options)}'
+ assert not options, 'Abstract types can only contain the abstract attribute. Received: abstract, ' + ', '.join(options)
else:
super_class = super(cls, cls)
if hasattr(super_class, '__init_subclass_with_meta__'):
diff --git a/graphene/utils/trim_docstring.py b/graphene/utils/trim_docstring.py
index ea6a197..59591c7 100644
--- a/graphene/utils/trim_docstring.py
+++ b/graphene/utils/trim_docstring.py
@@ -1 +1,30 @@
-import inspect
\ No newline at end of file
+import inspect
+
+def trim_docstring(docstring):
+ """
+ Trim and clean up docstring indentation and whitespace.
+ Based on PEP 257's trim function.
+ """
+ if not docstring:
+ return None
+ # Convert tabs to spaces (following the normal Python rules)
+ # and split into a list of lines:
+ lines = docstring.expandtabs().splitlines()
+ # Determine minimum indentation (first line doesn't count):
+ indent = float('inf')
+ for line in lines[1:]:
+ stripped = line.lstrip()
+ if stripped:
+ indent = min(indent, len(line) - len(stripped))
+ # Remove indentation (first line is special):
+ trimmed = [lines[0].strip()]
+ if indent < float('inf'):
+ for line in lines[1:]:
+ trimmed.append(line[indent:].rstrip())
+ # Strip off trailing and leading blank lines:
+ while trimmed and not trimmed[-1]:
+ trimmed.pop()
+ while trimmed and not trimmed[0]:
+ trimmed.pop(0)
+ # Return a single string:
+ return '\n'.join(trimmed)
\ No newline at end of file