File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 44from pytest import raises
55
66from graphql .error import GraphQLError
7- from graphql .execution import MiddlewareManager , execute
7+ from graphql .execution import execute
8+ from graphql .language .ast import ObjectTypeDefinition
89from graphql .language .parser import parse
910from graphql .type import (
1011 GraphQLArgument ,
@@ -553,11 +554,18 @@ def test_fails_to_execute_a_query_containing_a_type_definition():
553554 with raises (GraphQLError ) as excinfo :
554555 execute (schema , query )
555556
557+ error = excinfo .value
558+
556559 assert (
557- excinfo . value .message
560+ error .message
558561 == "GraphQL cannot execute a request containing a ObjectTypeDefinition."
559562 )
560563
564+ nodes = error .nodes
565+ assert type (nodes ) is list
566+ assert len (nodes ) == 1
567+ assert isinstance (nodes [0 ], ObjectTypeDefinition )
568+
561569
562570def test_exceptions_are_reraised_if_specified (mocker ):
563571 # type: (MockFixture) -> None
Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ def __init__(
9898 u"GraphQL cannot execute a request containing a {}." .format (
9999 definition .__class__ .__name__
100100 ),
101- definition ,
101+ [ definition ] ,
102102 )
103103
104104 if not operation :
You can’t perform that action at this time.
0 commit comments