|
9 | 9 |
|
10 | 10 |
|
11 | 11 | def describe_printer_query_document():
|
12 |
| - |
13 |
| - # noinspection PyShadowingNames |
14 |
| - def does_not_alter_ast(kitchen_sink_query): # noqa: F811 |
15 |
| - ast = parse(kitchen_sink_query) |
16 |
| - ast_before = deepcopy(ast) |
17 |
| - print_ast(ast) |
18 |
| - assert ast == ast_before |
19 |
| - |
20 | 12 | def prints_minimal_ast():
|
21 | 13 | ast = FieldNode(name=NameNode(value="foo"))
|
22 | 14 | assert print_ast(ast) == "foo"
|
@@ -136,10 +128,15 @@ def legacy_correctly_prints_fragment_defined_variables():
|
136 | 128 | fragment_with_variable = parse(source, allow_legacy_fragment_variables=True)
|
137 | 129 | assert print_ast(fragment_with_variable) == dedent(source)
|
138 | 130 |
|
139 |
| - # noinspection PyShadowingNames |
140 |
| - def prints_kitchen_sink(kitchen_sink_query): # noqa: F811 |
141 |
| - ast = parse(kitchen_sink_query) |
| 131 | + def prints_kitchen_sink_without_altering_ast(kitchen_sink_query): # noqa: F811 |
| 132 | + ast = parse(kitchen_sink_query, no_location=True) |
| 133 | + |
| 134 | + ast_before_print_call = deepcopy(ast) |
142 | 135 | printed = print_ast(ast)
|
| 136 | + printed_ast = parse(printed, no_location=True) |
| 137 | + assert printed_ast == ast |
| 138 | + assert deepcopy(ast) == ast_before_print_call |
| 139 | + |
143 | 140 | assert printed == dedent(
|
144 | 141 | r'''
|
145 | 142 | query queryName($foo: ComplexType, $site: Site = MOBILE) @onQuery {
|
|
0 commit comments