# Path: graphscale/grapple/graphql_printer.py
# def print_graphql_defs(document_ast: GrappleDocument) -> str:
#     writer = CodeWriter()
#     for object_type in document_ast.object_types():
#         print_graphql_object_type(writer, document_ast, object_type)
#     for input_type in document_ast.input_types():
#         print_graphql_input_type(writer, input_type)
#     for enum_type in document_ast.enum_types():
#         print_graphql_enum_type(writer, enum_type)
# 
#     return writer.result()
# 
# Path: graphscale/grapple/parser.py
# def parse_grapple(grapple_string: str) -> GrappleDocument:
#     ast = parse(Source(grapple_string))
#     grapple_types = []
#     for type_node in ast.definitions:
#         grapple_types.append(create_grapple_type_definition(type_node))
#     return GrappleDocument(types=grapple_types)


from typing import Any
from graphscale.grapple.graphql_printer import print_graphql_defs
from graphscale.grapple.parser import parse_grapple



def assert_graphql_def(snapshot: Any, graphql: str) -> None:
    result = print_graphql_defs(parse_grapple(graphql))
    snapshot.assert_match(result)


def test_basic_type(snapshot: Any) -> None:
    assert_graphql_def(snapshot, """type Test { name: String }""")


def test_non_pythonic_name(snapshot: Any) -> None:
    assert_graphql_def(snapshot, """type Test { longName: String }""")



# Path: graphscale/grapple/graphql_printer.py
# def print_graphql_defs(document_ast: GrappleDocument) -> str:
#     writer = CodeWriter()
#     for object_type in document_ast.object_types():
#         print_graphql_object_type(writer, document_ast, object_type)
#     for input_type in document_ast.input_types():
#         print_graphql_input_type(writer, input_type)
#     for enum_type in document_ast.enum_types():
#         print_graphql_enum_type(writer, enum_type)
# 
#     return writer.result()
# 
# Path: graphscale/grapple/parser.py
# def parse_grapple(grapple_string: str) -> GrappleDocument:
#     ast = parse(Source(grapple_string))
#     grapple_types = []
#     for type_node in ast.definitions:
#         grapple_types.append(create_grapple_type_definition(type_node))
#     return GrappleDocument(types=grapple_types)


# Path: tests/test_graphql_grapple.py
from typing import Any
from graphscale.grapple.graphql_printer import print_graphql_defs
from graphscale.grapple.parser import parse_grapple




def assert_graphql_def(snapshot: Any, graphql: str) -> None:
    result = print_graphql_defs(parse_grapple(graphql))
    snapshot.assert_match(result)


def test_basic_type(snapshot: Any) -> None:
    assert_graphql_def(snapshot, """type Test { name: String }""")


def test_non_pythonic_name(snapshot: Any) -> None:
    assert_graphql_def(snapshot, """type Test { longName: String }""")



def test_nonnullable_type(snapshot: Any) -> None: