def test_enum(): graphql = """ type Hospital { status: HospitalStatus reqStatus: HospitalStatus! } enum HospitalStatus { AS_SUBMITTED } """ result = print_graphql_defs(parse_grapple(graphql)) assert result == """class GraphQLHospital(GrappleType):
def test_req_list_of_reqs(): graphql = """type Test { names: [String!]! }""" result = print_graphql_defs(parse_grapple(graphql)) assert result == """class GraphQLTest(GrappleType):
def test_basic_type(): graphql = """type Test { name: String }""" result = print_graphql_defs(parse_grapple(graphql)) assert result == """class GraphQLTest(GrappleType):
def test_non_pythonic_name(): graphql = """type Test { longName: String }""" result = print_graphql_defs(parse_grapple(graphql)) assert result == """class GraphQLTest(GrappleType):
def test_args(): graphql = """type Test { relatives(skip: Int, take: Int) : [Test] }""" result = print_graphql_defs(parse_grapple(graphql)) assert result == """class GraphQLTest(GrappleType):
def test_ref_to_self(): graphql = """type Test { other: Test }""" result = print_graphql_defs(parse_grapple(graphql)) assert result == """class GraphQLTest(GrappleType):
def test_double_list(): graphql = """type Test { matrix: [[String]] }""" result = print_graphql_defs(parse_grapple(graphql)) assert result == """class GraphQLTest(GrappleType):