Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
),
),
(
"anotherField",
GraphQLField(
name="anotherField",
gql_type=GraphQLList(gql_type="Int"),
),
),
(
"fieldWithDefaultValueArg",
GraphQLField(
name="fieldWithDefaultValueArg",
gql_type="ID",
arguments=OrderedDict(
test=GraphQLArgument(
name="test",
gql_type="String",
default_value="default",
)
),
),
),
(
"simpleField",
GraphQLField(name="simpleField", gql_type="Date"),
),
]
),
interfaces=["Unknown", "Empty"],
)
)
gql_type=GraphQLList(
gql_type=GraphQLList(
gql_type=GraphQLNonNull(gql_type="Date")
)
)
),
),
),
)
)
expected_schema.add_definition(
GraphQLInputObjectType(
name="UserInfo",
fields=OrderedDict(
[
("name", GraphQLArgument(name="name", gql_type="String")),
(
"dateOfBirth",
GraphQLArgument(
name="dateOfBirth",
gql_type=GraphQLList(gql_type="Date"),
),
),
(
"graphQLFan",
GraphQLArgument(
name="graphQLFan",
gql_type=GraphQLNonNull(gql_type="Boolean"),
),
),
]
),
assert arg == GraphQLArgument(
name="Name",
gql_type="Test",
default_value=42,
description="description",
)
# Currently we ignore the description in comparing
assert arg == GraphQLArgument(
name="Name", gql_type="Test", default_value=42
)
## Different
assert arg != GraphQLArgument(
name="Name", gql_type="Test", default_value=24
)
assert arg != GraphQLArgument(name="Name", gql_type="Test")
assert arg != GraphQLArgument(
name="Name", gql_type="NotTest", default_value=42
)
assert arg != GraphQLArgument(
name="OtherName", gql_type="Test", default_value=42
)
def test_graphql_input_object_repr():
input_object = GraphQLInputObjectType(
name="Name",
fields=OrderedDict(
[
("test", GraphQLArgument(name="arg", gql_type="Int")),
("another", GraphQLArgument(name="arg", gql_type="String")),
]
),
description="description",
)
assert (
input_object.__repr__() == "GraphQLInputObjectType(name='Name', "
"fields=OrderedDict(["
"('test', GraphQLArgument(name='arg', gql_type='Int', default_value=None, description=None, directives=None)), "
"('another', GraphQLArgument(name='arg', gql_type='String', default_value=None, description=None, directives=None))"
"]), description='description')"
)
assert input_object == eval(repr(input_object))
def test_graphql_argument_eq():
arg = GraphQLArgument(
name="Name",
gql_type="Test",
default_value=42,
description="description",
)
## Same
assert arg == arg
assert arg == GraphQLArgument(
name="Name",
gql_type="Test",
default_value=42,
description="description",
)
# Currently we ignore the description in comparing
assert arg == GraphQLArgument(
def test_graphql_argument_eq():
arg = GraphQLArgument(
name="Name",
gql_type="Test",
default_value=42,
description="description",
)
## Same
assert arg == arg
assert arg == GraphQLArgument(
name="Name",
gql_type="Test",
default_value=42,
description="description",
)
# Currently we ignore the description in comparing
assert arg == GraphQLArgument(
name="Name", gql_type="Test", default_value=42
)
## Different
assert arg != GraphQLArgument(
name="Name", gql_type="Test", default_value=24
)
assert arg != GraphQLArgument(name="Name", gql_type="Test")
assert arg != GraphQLArgument(
name="Name", gql_type="NotTest", default_value=42
if not input_value_definition_node:
return None
init_kwargs = {
"name": parse_name(input_value_definition_node.name, schema),
"description": parse_name(
input_value_definition_node.description, schema
),
"gql_type": parse_type(input_value_definition_node.type, schema),
"default_value": input_value_definition_node.default_value,
"directives": input_value_definition_node.directives,
}
if not as_argument_definition:
return GraphQLInputField(**init_kwargs)
return GraphQLArgument(
**init_kwargs, definition=input_value_definition_node
)