Skip to content

Commit 6dcd608

Browse files
authored
Merge pull request #70 from Globegitter/road-to-v0.6.0
Road to v0.6.0
2 parents 9038808 + e92d1e6 commit 6dcd608

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1887
-546
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# Byte-compiled / optimized / DLL files
55
__pycache__/
66
*.py[cod]
7+
venv
78

89
# C extensions
910
*.so
@@ -61,6 +62,7 @@ target/
6162

6263
# IntelliJ
6364
.idea
65+
*.iml
6466

6567
# OS X
6668
.DS_Store

graphql/__init__.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,46 @@
6161
GraphQLInputObjectField,
6262
GraphQLArgument,
6363

64+
# "Enum" of Type Kinds
65+
TypeKind,
66+
67+
# "Enum" of Directive locations
68+
DirectiveLocation,
69+
6470
# Scalars
6571
GraphQLInt,
6672
GraphQLFloat,
6773
GraphQLString,
6874
GraphQLBoolean,
6975
GraphQLID,
7076

77+
# Directive definition
78+
GraphQLDirective,
79+
80+
# Built-in directives defined by the Spec
81+
specified_directives,
82+
GraphQLSkipDirective,
83+
GraphQLIncludeDirective,
84+
GraphQLDeprecatedDirective,
85+
86+
# Constant Deprecation Reason
87+
DEFAULT_DEPRECATION_REASON,
88+
89+
# GraphQL Types for introspection.
90+
__Schema,
91+
__Directive,
92+
__DirectiveLocation,
93+
__Type,
94+
__Field,
95+
__InputValue,
96+
__EnumValue,
97+
__TypeKind,
98+
99+
# Meta-field definitions.
100+
SchemaMetaFieldDef,
101+
TypeMetaFieldDef,
102+
TypeNameMetaFieldDef,
103+
71104
# Predicates
72105
is_type,
73106
is_input_type,
@@ -190,6 +223,25 @@
190223
'GraphQLSchema',
191224
'GraphQLString',
192225
'GraphQLUnionType',
226+
'GraphQLDirective',
227+
'specified_directives',
228+
'GraphQLSkipDirective',
229+
'GraphQLIncludeDirective',
230+
'GraphQLDeprecatedDirective',
231+
'DEFAULT_DEPRECATION_REASON',
232+
'TypeKind',
233+
'DirectiveLocation',
234+
'__Schema',
235+
'__Directive',
236+
'__DirectiveLocation',
237+
'__Type',
238+
'__Field',
239+
'__InputValue',
240+
'__EnumValue',
241+
'__TypeKind',
242+
'SchemaMetaFieldDef',
243+
'TypeMetaFieldDef',
244+
'TypeNameMetaFieldDef',
193245
'get_named_type',
194246
'get_nullable_type',
195247
'is_abstract_type',

graphql/execution/executor.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -321,16 +321,18 @@ def complete_abstract_value(exe_context, return_type, field_asts, info, result):
321321
else:
322322
runtime_type = get_default_resolve_type_fn(result, exe_context.context_value, info, return_type)
323323

324-
assert isinstance(runtime_type, GraphQLObjectType), (
325-
'Abstract type {} must resolve to an Object type at runtime ' +
326-
'for field {}.{} with value "{}", received "{}".'
327-
).format(
328-
return_type,
329-
info.parent_type,
330-
info.field_name,
331-
result,
332-
runtime_type,
333-
)
324+
if not isinstance(runtime_type, GraphQLObjectType):
325+
raise GraphQLError(
326+
('Abstract type {} must resolve to an Object type at runtime ' +
327+
'for field {}.{} with value "{}", received "{}".').format(
328+
return_type,
329+
info.parent_type,
330+
info.field_name,
331+
result,
332+
runtime_type,
333+
),
334+
field_asts
335+
)
334336

335337
if not exe_context.schema.is_possible_type(return_type, runtime_type):
336338
raise GraphQLError(

graphql/execution/tests/test_executor.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -285,21 +285,6 @@ class Data(object):
285285
assert result.data == {'second': 'b'}
286286

287287

288-
def test_uses_the_named_operation_if_operation_name_is_provided():
289-
doc = 'query Example { first: a } query OtherExample { second: a }'
290-
291-
class Data(object):
292-
a = 'b'
293-
294-
ast = parse(doc)
295-
Type = GraphQLObjectType('Type', {
296-
'a': GraphQLField(GraphQLString)
297-
})
298-
result = execute(GraphQLSchema(Type), ast, Data(), operation_name='OtherExample')
299-
assert not result.errors
300-
assert result.data == {'second': 'b'}
301-
302-
303288
def test_raises_if_no_operation_is_provided():
304289
doc = 'fragment Example on Type { a }'
305290

graphql/execution/values.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def get_variable_values(schema, definition_asts, inputs):
2929
return values
3030

3131

32-
def get_argument_values(arg_defs, arg_asts, variables):
32+
def get_argument_values(arg_defs, arg_asts, variables=None):
3333
"""Prepares an object map of argument values given a list of argument
3434
definitions and list of argument AST nodes."""
3535
if not arg_defs:

0 commit comments

Comments
 (0)