diff --git a/tests/starwars/test_dsl.py b/tests/starwars/test_dsl.py index 5807e87f..b105cfa3 100644 --- a/tests/starwars/test_dsl.py +++ b/tests/starwars/test_dsl.py @@ -264,9 +264,15 @@ def test_multiple_operations(ds): ), ) + """ + From graphql-core version 3.1.5, print_ast() break arguments over multiple lines + Accepting both cases here + """ + assert ( - print_ast(query) - == """query GetHeroName { + ( + print_ast(query) + == """query GetHeroName { hero { name } @@ -280,6 +286,26 @@ def test_multiple_operations(ds): } } """ + ) + or ( + print_ast(query) + == """query GetHeroName { + hero { + name + } +} + +mutation CreateReviewMutation { + createReview( + episode: JEDI + review: {stars: 5, commentary: "This is a great movie!"} + ) { + stars + commentary + } +} +""" + ) ) diff --git a/tests/starwars/test_validation.py b/tests/starwars/test_validation.py index 00384c99..468bb553 100644 --- a/tests/starwars/test_validation.py +++ b/tests/starwars/test_validation.py @@ -75,9 +75,23 @@ def validation_errors(client, query): def test_incompatible_request_gql(client): - with pytest.raises(TypeError) as exc_info: + with pytest.raises(TypeError): gql(123) - assert "body must be a string" in str(exc_info.value) + + """ + The error generated depends on graphql-core version + < 3.1.5: "body must be a string" + >= 3.1.5: some variation of "object of type 'int' has no len()" + depending on the python environment + + So we are not going to check the exact error message here anymore. + """ + + """ + assert ("body must be a string" in str(exc_info.value)) or ( + "object of type 'int' has no len()" in str(exc_info.value) + ) + """ def test_nested_query_with_fragment(client):