solve most deprecation warning

This commit is contained in:
Wong Chun Hong 2023-08-30 02:29:24 +01:00
parent f3f33dec9f
commit 23c84c1d66
8 changed files with 18 additions and 16 deletions

View File

@ -72,7 +72,7 @@ def test_fetch_some_id_query(snapshot):
} }
""" """
params = {"someId": "1000"} params = {"someId": "1000"}
snapshot.assert_match(client.execute(query, variables=params)) snapshot.assert_match(client.execute(query, variable_values=params))
def test_fetch_some_id_query2(snapshot): def test_fetch_some_id_query2(snapshot):
@ -84,7 +84,7 @@ def test_fetch_some_id_query2(snapshot):
} }
""" """
params = {"someId": "1002"} params = {"someId": "1002"}
snapshot.assert_match(client.execute(query, variables=params)) snapshot.assert_match(client.execute(query, variable_values=params))
def test_invalid_id_query(snapshot): def test_invalid_id_query(snapshot):
@ -96,7 +96,7 @@ def test_invalid_id_query(snapshot):
} }
""" """
params = {"id": "not a valid id"} params = {"id": "not a valid id"}
snapshot.assert_match(client.execute(query, variables=params)) snapshot.assert_match(client.execute(query, variable_values=params))
def test_fetch_luke_aliased(snapshot): def test_fetch_luke_aliased(snapshot):

View File

@ -24,7 +24,7 @@ def test_abstract_objecttype_warn_deprecation(mocker):
def test_generate_objecttype_inherit_abstracttype(): def test_generate_objecttype_inherit_abstracttype():
class MyAbstractType(AbstractType): class MyAbstractType:
field1 = MyScalar() field1 = MyScalar()
class MyObjectType(ObjectType, MyAbstractType): class MyObjectType(ObjectType, MyAbstractType):

View File

@ -110,7 +110,7 @@ def test_datetime_query_variable(sample_datetime):
# test datetime variable provided as Python datetime # test datetime variable provided as Python datetime
result = schema.execute( result = schema.execute(
"""query Test($date: DateTime){ datetime(in: $date) }""", """query Test($date: DateTime){ datetime(in: $date) }""",
variables={"date": sample_datetime}, variable_values={"date": sample_datetime},
) )
assert not result.errors assert not result.errors
assert result.data == {"datetime": isoformat} assert result.data == {"datetime": isoformat}
@ -118,7 +118,7 @@ def test_datetime_query_variable(sample_datetime):
# test datetime variable in string representation # test datetime variable in string representation
result = schema.execute( result = schema.execute(
"""query Test($date: DateTime){ datetime(in: $date) }""", """query Test($date: DateTime){ datetime(in: $date) }""",
variables={"date": isoformat}, variable_values={"date": isoformat},
) )
assert not result.errors assert not result.errors
assert result.data == {"datetime": isoformat} assert result.data == {"datetime": isoformat}
@ -130,14 +130,15 @@ def test_date_query_variable(sample_date):
# test date variable provided as Python date # test date variable provided as Python date
result = schema.execute( result = schema.execute(
"""query Test($date: Date){ date(in: $date) }""", """query Test($date: Date){ date(in: $date) }""",
variables={"date": sample_date}, variable_values={"date": sample_date},
) )
assert not result.errors assert not result.errors
assert result.data == {"date": isoformat} assert result.data == {"date": isoformat}
# test date variable in string representation # test date variable in string representation
result = schema.execute( result = schema.execute(
"""query Test($date: Date){ date(in: $date) }""", variables={"date": isoformat} """query Test($date: Date){ date(in: $date) }""",
variable_values={"date": isoformat},
) )
assert not result.errors assert not result.errors
assert result.data == {"date": isoformat} assert result.data == {"date": isoformat}
@ -149,14 +150,15 @@ def test_time_query_variable(sample_time):
# test time variable provided as Python time # test time variable provided as Python time
result = schema.execute( result = schema.execute(
"""query Test($time: Time){ time(at: $time) }""", """query Test($time: Time){ time(at: $time) }""",
variables={"time": sample_time}, variable_values={"time": sample_time},
) )
assert not result.errors assert not result.errors
assert result.data == {"time": isoformat} assert result.data == {"time": isoformat}
# test time variable in string representation # test time variable in string representation
result = schema.execute( result = schema.execute(
"""query Test($time: Time){ time(at: $time) }""", variables={"time": isoformat} """query Test($time: Time){ time(at: $time) }""",
variable_values={"time": isoformat},
) )
assert not result.errors assert not result.errors
assert result.data == {"time": isoformat} assert result.data == {"time": isoformat}
@ -171,7 +173,7 @@ def test_bad_variables(sample_date, sample_datetime, sample_time):
"""query Test($input: {}){{ {}(in: $input) }}""".format( """query Test($input: {}){{ {}(in: $input) }}""".format(
type_, type_.lower() type_, type_.lower()
), ),
variables={"input": input_}, variable_values={"input": input_},
) )
assert len(result.errors) == 1 assert len(result.errors) == 1
# when `input` is not JSON serializable formatting the error message in # when `input` is not JSON serializable formatting the error message in

View File

@ -28,7 +28,7 @@ def test_decimal_string_query_variable():
result = schema.execute( result = schema.execute(
"""query Test($decimal: Decimal){ decimal(input: $decimal) }""", """query Test($decimal: Decimal){ decimal(input: $decimal) }""",
variables={"decimal": decimal_value}, variable_values={"decimal": decimal_value},
) )
assert not result.errors assert not result.errors
assert result.data == {"decimal": str(decimal_value)} assert result.data == {"decimal": str(decimal_value)}

View File

@ -39,7 +39,7 @@ def test_generic_query_variable():
]: ]:
result = schema.execute( result = schema.execute(
"""query Test($generic: GenericScalar){ generic(input: $generic) }""", """query Test($generic: GenericScalar){ generic(input: $generic) }""",
variables={"generic": generic_value}, variable_values={"generic": generic_value},
) )
assert not result.errors assert not result.errors
assert result.data == {"generic": generic_value} assert result.data == {"generic": generic_value}

View File

@ -27,7 +27,7 @@ def test_jsonstring_query_variable():
result = schema.execute( result = schema.execute(
"""query Test($json: JSONString){ json(input: $json) }""", """query Test($json: JSONString){ json(input: $json) }""",
variables={"json": json_value}, variable_values={"json": json_value},
) )
assert not result.errors assert not result.errors
assert result.data == {"json": json_value} assert result.data == {"json": json_value}

View File

@ -464,7 +464,7 @@ def test_query_annotated_resolvers():
assert not result.errors assert not result.errors
assert result.data == {"annotated": "base-self"} assert result.data == {"annotated": "base-self"}
result = test_schema.execute("{ context }", "base", context=context) result = test_schema.execute("{ context }", "base", context_value=context)
assert not result.errors assert not result.errors
assert result.data == {"context": "base-context"} assert result.data == {"context": "base-context"}

View File

@ -25,7 +25,7 @@ def test_uuidstring_query_variable():
result = schema.execute( result = schema.execute(
"""query Test($uuid: UUID){ uuid(input: $uuid) }""", """query Test($uuid: UUID){ uuid(input: $uuid) }""",
variables={"uuid": uuid_value}, variable_values={"uuid": uuid_value},
) )
assert not result.errors assert not result.errors
assert result.data == {"uuid": uuid_value} assert result.data == {"uuid": uuid_value}