Skip to content

Commit a5ff57c

Browse files
committed
Allow new error message when passing an int to gql
1 parent 73d0ba5 commit a5ff57c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tests/starwars/test_validation.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,17 @@ def validation_errors(client, query):
7777
def test_incompatible_request_gql(client):
7878
with pytest.raises(TypeError) as exc_info:
7979
gql(123)
80-
assert "body must be a string" in str(exc_info.value)
80+
81+
"""
82+
The error generated depends on graphql-core version
83+
< 3.1.5: "body must be a string"
84+
>= 3.1.5: "object of type 'int' has no len()"
85+
86+
Just accepting both cases for now
87+
"""
88+
assert ("body must be a string" in str(exc_info.value)) or (
89+
"object of type 'int' has no len()" in str(exc_info.value)
90+
)
8191

8292

8393
def test_nested_query_with_fragment(client):

0 commit comments

Comments
 (0)