|
3 | 3 | from graphql.language import DirectiveLocation
|
4 | 4 | from graphql.type import (
|
5 | 5 | GraphQLField,
|
6 |
| - GraphQLInterfaceType, |
7 | 6 | GraphQLObjectType,
|
8 | 7 | GraphQLScalarType,
|
9 | 8 | GraphQLSchema,
|
|
15 | 14 | GraphQLList,
|
16 | 15 | )
|
17 | 16 |
|
18 |
| -InterfaceType = GraphQLInterfaceType( |
19 |
| - "Interface", {"fieldName": GraphQLField(GraphQLString)} |
20 |
| -) |
21 |
| - |
22 |
| -DirectiveInputType = GraphQLInputObjectType( |
23 |
| - "DirInput", {"field": GraphQLInputField(GraphQLString)} |
24 |
| -) |
25 |
| - |
26 |
| -WrappedDirectiveInputType = GraphQLInputObjectType( |
27 |
| - "WrappedDirInput", {"field": GraphQLInputField(GraphQLString)} |
28 |
| -) |
29 |
| - |
30 |
| -Directive = GraphQLDirective( |
31 |
| - name="dir", |
32 |
| - locations=[DirectiveLocation.OBJECT], |
33 |
| - args={ |
34 |
| - "arg": GraphQLArgument(DirectiveInputType), |
35 |
| - "argList": GraphQLArgument(GraphQLList(WrappedDirectiveInputType)), |
36 |
| - }, |
37 |
| -) |
38 |
| - |
39 |
| -Schema = GraphQLSchema( |
40 |
| - query=GraphQLObjectType( |
41 |
| - "Query", {"getObject": GraphQLField(InterfaceType, resolve=lambda: {})} |
42 |
| - ), |
43 |
| - directives=[Directive], |
44 |
| -) |
45 |
| - |
46 | 17 |
|
47 | 18 | def describe_type_system_schema():
|
48 | 19 | def describe_type_map():
|
49 | 20 | def includes_input_types_only_used_in_directives():
|
50 |
| - assert "DirInput" in Schema.type_map |
51 |
| - assert "WrappedDirInput" in Schema.type_map |
| 21 | + directive = GraphQLDirective( |
| 22 | + name="dir", |
| 23 | + locations=[DirectiveLocation.OBJECT], |
| 24 | + args={ |
| 25 | + "arg": GraphQLArgument( |
| 26 | + GraphQLInputObjectType( |
| 27 | + "Foo", {"field": GraphQLInputField(GraphQLString)} |
| 28 | + ) |
| 29 | + ), |
| 30 | + "argList": GraphQLArgument( |
| 31 | + GraphQLList( |
| 32 | + GraphQLInputObjectType( |
| 33 | + "Bar", {"field": GraphQLInputField(GraphQLString)} |
| 34 | + ) |
| 35 | + ) |
| 36 | + ), |
| 37 | + }, |
| 38 | + ) |
| 39 | + schema = GraphQLSchema(directives=[directive]) |
| 40 | + assert "Foo" in schema.type_map |
| 41 | + assert "Bar" in schema.type_map |
52 | 42 |
|
53 | 43 | def describe_validity():
|
54 | 44 | def describe_when_not_assumed_valid():
|
|
0 commit comments