Debian Codegraph @

tests/utilities/test_concat_ast.py

raw
1 from graphql.language import parse, print_ast, Source
2 from graphql.utilities import concat_ast
3
4 from ..utils import dedent
5
6
7 def describe_concat_ast():
8 def concatenates_two_asts_together():
9 source_a = Source("""
10 { a, b, ... Frag }
11 """)
12
13 source_b = Source("""
14 fragment Frag on T {
15 c
16 }
17 """)
18
19 ast_a = parse(source_a)
20 ast_b = parse(source_b)
21 ast_c = concat_ast([ast_a, ast_b])
22
23 assert print_ast(ast_c) == dedent("""
24 {
25 a
26 b
27 ...Frag
28 }
29
30 fragment Frag on T {
31 c
32 }
33 """)