File tree Expand file tree Collapse file tree 2 files changed +8
-19
lines changed Expand file tree Collapse file tree 2 files changed +8
-19
lines changed Original file line number Diff line number Diff line change 1111
1212def located_error (
1313 original_error : Exception ,
14- nodes : Optional [Union ["None" , Collection ["Node" ]]],
14+ nodes : Optional [Union ["None" , Collection ["Node" ]]] = None ,
1515 path : Optional [Collection [Union [str , int ]]] = None ,
1616) -> GraphQLError :
1717 """Located GraphQL Error
Original file line number Diff line number Diff line change 22
33from graphql .error import GraphQLError , located_error
44
5- from ..utils import dedent
6-
75
86def describe_located_error ():
97 def throws_without_an_original_error ():
@@ -26,23 +24,14 @@ def does_not_pass_through_elasticsearch_like_errors():
2624 cast (Any , e ).path = "/something/feed/_search"
2725 assert located_error (e , [], []) is not e
2826
29- def handles_proxy_error_messages ():
30- class ProxyString :
31- def __init__ (self , value ):
32- self .value = value
33-
34- def __str__ (self ):
35- return self .value
27+ def handles_lazy_error_messages ():
28+ class LazyString :
29+ def __str__ (self ) -> str :
30+ return "lazy"
3631
37- class MyError (Exception ):
32+ class LazyError (Exception ):
3833 def __init__ (self ):
39- self .message = ProxyString ( "Example error" )
34+ self .message = LazyString ( )
4035 super ().__init__ ()
4136
42- error = located_error (MyError (), [], [])
43-
44- assert str (error ) == dedent (
45- """
46- Example error
47- """
48- )
37+ assert str (located_error (LazyError ())) == "lazy"
You can’t perform that action at this time.
0 commit comments