From 6c97a906922db9f980e7507b38124da8aa399dec Mon Sep 17 00:00:00 2001 From: as Date: Tue, 11 Dec 2018 08:12:41 +0100 Subject: [PATCH] fixed some of pre-commit's complaints --- docs/quickstart.rst | 2 +- graphene/types/tests/test_datetime.py | 23 +++++++++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 8c0055c6..fc333fae 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -30,7 +30,7 @@ server with an associated set of resolve methods that know how to fetch data. We are going to create a very simple schema, with a ``Query`` with only -one field: ``hello`` and an input name. And when we query it, it should return ``"Hello +one field: ``hello`` and an input name. And when we query it, it should return ``"Hello {argument}"``. .. code:: python diff --git a/graphene/types/tests/test_datetime.py b/graphene/types/tests/test_datetime.py index 47841760..0d9ee114 100644 --- a/graphene/types/tests/test_datetime.py +++ b/graphene/types/tests/test_datetime.py @@ -145,12 +145,14 @@ def test_time_query_variable(): assert result.data == {"time": isoformat} -@pytest.mark.xfail(reason="creating the error message fails when un-parsable object is not JSON serializable.") +@pytest.mark.xfail( + reason="creating the error message fails when un-parsable object is not JSON serializable." +) def test_bad_variables(): def _test_bad_variables(type, input): result = schema.execute( - """query Test($input: %s){ %s(in: $input) }""" % (type, type.lower()), - variables={"input": input} + """query Test($input: {}){{ {}(in: $input) }}""".format(type, type.lower()), + variables={"input": input}, ) assert len(result.errors) == 1 # when `input` is not JSON serializable formatting the error message in @@ -166,9 +168,18 @@ def test_bad_variables(): time = datetime.time(now.hour, now.minute, now.second, now.microsecond, now.tzinfo) bad_pairs = [ - ('DateTime', not_a_date), ('DateTime', not_a_date_str), ('DateTime', today), ('DateTime', time), - ('Date', not_a_date), ('Date', not_a_date_str), ('Date', now), ('Date', time), - ('Time', not_a_date), ('Time', not_a_date_str), ('Time', now), ('Time', today) + ("DateTime", not_a_date), + ("DateTime", not_a_date_str), + ("DateTime", today), + ("DateTime", time), + ("Date", not_a_date), + ("Date", not_a_date_str), + ("Date", now), + ("Date", time), + ("Time", not_a_date), + ("Time", not_a_date_str), + ("Time", now), + ("Time", today), ] for type, input in bad_pairs: