|
10 | 10 | visit,
|
11 | 11 | Visitor,
|
12 | 12 | )
|
13 |
| -from graphql.type import get_named_type, is_composite_type |
| 13 | +from graphql.type import GraphQLSchema, get_named_type, is_composite_type |
14 | 14 | from graphql.utilities import TypeInfo, TypeInfoVisitor, build_schema
|
15 | 15 |
|
16 |
| -from ..validation.harness import test_schema |
17 |
| - |
18 | 16 | from ..fixtures import kitchen_sink_query # noqa: F401
|
19 | 17 |
|
20 | 18 |
|
| 19 | +test_schema = build_schema( |
| 20 | + """ |
| 21 | + interface Pet { |
| 22 | + name: String |
| 23 | + } |
| 24 | +
|
| 25 | + type Dog implements Pet { |
| 26 | + name: String |
| 27 | + } |
| 28 | +
|
| 29 | + type Cat implements Pet { |
| 30 | + name: String |
| 31 | + } |
| 32 | +
|
| 33 | + type Human { |
| 34 | + name: String |
| 35 | + pets: [Pet] |
| 36 | + } |
| 37 | +
|
| 38 | + type Alien { |
| 39 | + name(surname: Boolean): String |
| 40 | + } |
| 41 | +
|
| 42 | + type QueryRoot { |
| 43 | + human(id: ID): Human |
| 44 | + alien: Alien |
| 45 | + } |
| 46 | +
|
| 47 | + schema { |
| 48 | + query: QueryRoot |
| 49 | + } |
| 50 | + """ |
| 51 | +) |
| 52 | + |
| 53 | + |
21 | 54 | def describe_type_info():
|
| 55 | + schema = GraphQLSchema() |
| 56 | + |
22 | 57 | def allow_all_methods_to_be_called_before_entering_any_mode():
|
23 |
| - type_info = TypeInfo(test_schema) |
| 58 | + type_info = TypeInfo(schema) |
24 | 59 |
|
25 | 60 | assert type_info.get_type() is None
|
26 | 61 | assert type_info.get_parent_type() is None
|
@@ -306,9 +341,16 @@ def leave(*args):
|
306 | 341 | def supports_traversal_of_input_values():
|
307 | 342 | visited = []
|
308 | 343 |
|
309 |
| - complex_input_type = test_schema.get_type("ComplexInput") |
| 344 | + schema = build_schema( |
| 345 | + """ |
| 346 | + input ComplexInput { |
| 347 | + stringListField: [String] |
| 348 | + } |
| 349 | + """ |
| 350 | + ) |
| 351 | + complex_input_type = schema.get_type("ComplexInput") |
310 | 352 | assert complex_input_type is not None
|
311 |
| - type_info = TypeInfo(test_schema, complex_input_type) |
| 353 | + type_info = TypeInfo(schema, complex_input_type) |
312 | 354 |
|
313 | 355 | ast = parse_value('{ stringListField: ["foo"] }')
|
314 | 356 |
|
|
0 commit comments