File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -1103,3 +1103,30 @@ def test_node_tree_with_loc(ds):
1103
1103
""" .strip ()
1104
1104
1105
1105
assert node_tree (document , ignore_loc = False ) == node_tree_result
1106
+
1107
+
1108
+ def test_legacy_fragment_with_variables (ds ):
1109
+ var = DSLVariableDefinitions ()
1110
+
1111
+ hero_fragment = (
1112
+ DSLFragment ("heroFragment" )
1113
+ .on (ds .Query )
1114
+ .select (
1115
+ ds .Query .hero .args (episode = var .episode ).select (ds .Character .name ),
1116
+ )
1117
+ )
1118
+
1119
+ print (hero_fragment )
1120
+
1121
+ hero_fragment .variable_definitions = var
1122
+
1123
+ query = dsl_gql (hero_fragment )
1124
+
1125
+ expected = """
1126
+ fragment heroFragment($episode: Episode) on Query {
1127
+ hero(episode: $episode) {
1128
+ name
1129
+ }
1130
+ }
1131
+ """ .strip ()
1132
+ assert print_ast (query ) == expected
You can’t perform that action at this time.
0 commit comments