File tree Expand file tree Collapse file tree 2 files changed +48
-43
lines changed
Expand file tree Collapse file tree 2 files changed +48
-43
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ def _node_tree_recursive(
1919 results .append (" " * indent + f"{ type (obj ).__name__ } " )
2020
2121 try :
22- keys = obj .keys
22+ keys = sorted ( obj .keys )
2323 except AttributeError :
2424 # If the object has no keys attribute, print its repr and return.
2525 results .append (" " * (indent + 1 ) + repr (obj ))
@@ -70,6 +70,9 @@ def node_tree(
7070
7171 Useful to debug deep DocumentNode instances created by gql or dsl_gql.
7272
73+ NOTE: from gql version 3.6.0b4 the elements of each node are sorted to ignore
74+ small changes in graphql-core
75+
7376 WARNING: the output of this method is not guaranteed and may change without notice.
7477 """
7578
Original file line number Diff line number Diff line change @@ -1030,11 +1030,10 @@ def test_node_tree_with_loc(ds):
10301030
10311031 node_tree_result = """
10321032DocumentNode
1033- loc:
1034- Location
1035- <Location 0:43>
10361033 definitions:
10371034 OperationDefinitionNode
1035+ directives:
1036+ empty tuple
10381037 loc:
10391038 Location
10401039 <Location 0:43>
@@ -1045,33 +1044,31 @@ def test_node_tree_with_loc(ds):
10451044 <Location 6:17>
10461045 value:
10471046 'GetHeroName'
1048- directives:
1049- empty tuple
1050- variable_definitions:
1051- empty tuple
1047+ operation:
1048+ <OperationType.QUERY: 'query'>
10521049 selection_set:
10531050 SelectionSetNode
10541051 loc:
10551052 Location
10561053 <Location 18:43>
10571054 selections:
10581055 FieldNode
1056+ alias:
1057+ None
1058+ arguments:
1059+ empty tuple
1060+ directives:
1061+ empty tuple
10591062 loc:
10601063 Location
10611064 <Location 22:41>
1062- directives:
1063- empty tuple
1064- alias:
1065- None
10661065 name:
10671066 NameNode
10681067 loc:
10691068 Location
10701069 <Location 22:26>
10711070 value:
10721071 'hero'
1073- arguments:
1074- empty tuple
10751072 nullability_assertion:
10761073 None
10771074 selection_set:
@@ -1081,37 +1078,39 @@ def test_node_tree_with_loc(ds):
10811078 <Location 27:41>
10821079 selections:
10831080 FieldNode
1081+ alias:
1082+ None
1083+ arguments:
1084+ empty tuple
1085+ directives:
1086+ empty tuple
10841087 loc:
10851088 Location
10861089 <Location 33:37>
1087- directives:
1088- empty tuple
1089- alias:
1090- None
10911090 name:
10921091 NameNode
10931092 loc:
10941093 Location
10951094 <Location 33:37>
10961095 value:
10971096 'name'
1098- arguments:
1099- empty tuple
11001097 nullability_assertion:
11011098 None
11021099 selection_set:
11031100 None
1104- operation:
1105- <OperationType.QUERY: 'query'>
1101+ variable_definitions:
1102+ empty tuple
1103+ loc:
1104+ Location
1105+ <Location 0:43>
11061106""" .strip ()
11071107
11081108 node_tree_result_stable = """
11091109DocumentNode
1110- loc:
1111- Location
1112- <Location 0:43>
11131110 definitions:
11141111 OperationDefinitionNode
1112+ directives:
1113+ empty tuple
11151114 loc:
11161115 Location
11171116 <Location 0:43>
@@ -1122,62 +1121,65 @@ def test_node_tree_with_loc(ds):
11221121 <Location 6:17>
11231122 value:
11241123 'GetHeroName'
1125- directives:
1126- empty tuple
1127- variable_definitions:
1128- empty tuple
1124+ operation:
1125+ <OperationType.QUERY: 'query'>
11291126 selection_set:
11301127 SelectionSetNode
11311128 loc:
11321129 Location
11331130 <Location 18:43>
11341131 selections:
11351132 FieldNode
1133+ alias:
1134+ None
1135+ arguments:
1136+ empty tuple
1137+ directives:
1138+ empty tuple
11361139 loc:
11371140 Location
11381141 <Location 22:41>
1139- directives:
1140- empty tuple
1141- alias:
1142- None
11431142 name:
11441143 NameNode
11451144 loc:
11461145 Location
11471146 <Location 22:26>
11481147 value:
11491148 'hero'
1150- arguments:
1151- empty tuple
11521149 selection_set:
11531150 SelectionSetNode
11541151 loc:
11551152 Location
11561153 <Location 27:41>
11571154 selections:
11581155 FieldNode
1156+ alias:
1157+ None
1158+ arguments:
1159+ empty tuple
1160+ directives:
1161+ empty tuple
11591162 loc:
11601163 Location
11611164 <Location 33:37>
1162- directives:
1163- empty tuple
1164- alias:
1165- None
11661165 name:
11671166 NameNode
11681167 loc:
11691168 Location
11701169 <Location 33:37>
11711170 value:
11721171 'name'
1173- arguments:
1174- empty tuple
11751172 selection_set:
11761173 None
1177- operation:
1178- <OperationType.QUERY: 'query'>
1174+ variable_definitions:
1175+ empty tuple
1176+ loc:
1177+ Location
1178+ <Location 0:43>
11791179""" .strip ()
11801180
1181+ print (node_tree (document , ignore_loc = False ))
1182+
11811183 try :
11821184 assert node_tree (document , ignore_loc = False ) == node_tree_result
11831185 except AssertionError :
You can’t perform that action at this time.
0 commit comments