Skip to content

Commit ba36f74

Browse files
committed
test_build_ast_schema: inline SDL in build_schema calls
Replicates graphql/graphql-js@2fe2025
1 parent b02486b commit ba36f74

File tree

2 files changed

+7
-24
lines changed

2 files changed

+7
-24
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ a query language for APIs created by Facebook.
1313
[![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
1414

1515
The current version 1.0.5 of GraphQL-core-next is up-to-date with GraphQL.js version
16-
14.3.1. All parts of the API are covered by an extensive test suite of currently 1817
16+
14.3.1. All parts of the API are covered by an extensive test suite of currently 1816
1717
unit tests.
1818

1919

tests/utilities/test_build_ast_schema.py

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -176,21 +176,21 @@ def supports_descriptions():
176176
assert cycle_sdl(sdl) == sdl
177177

178178
def maintains_skip_and_include_directives():
179-
sdl = dedent(
179+
schema = build_schema(
180180
"""
181181
type Query {
182182
str: String
183183
}
184184
"""
185185
)
186-
schema = build_schema(sdl)
186+
187187
assert len(schema.directives) == 3
188188
assert schema.get_directive("skip") is GraphQLSkipDirective
189189
assert schema.get_directive("include") is GraphQLIncludeDirective
190190
assert schema.get_directive("deprecated") is GraphQLDeprecatedDirective
191191

192192
def overriding_directives_excludes_specified():
193-
sdl = dedent(
193+
schema = build_schema(
194194
"""
195195
directive @skip on FIELD
196196
directive @include on FIELD
@@ -201,7 +201,7 @@ def overriding_directives_excludes_specified():
201201
}
202202
"""
203203
)
204-
schema = build_schema(sdl)
204+
205205
assert len(schema.directives) == 3
206206
get_directive = schema.get_directive
207207
assert get_directive("skip") is not GraphQLSkipDirective
@@ -211,25 +211,8 @@ def overriding_directives_excludes_specified():
211211
assert get_directive("deprecated") is not GraphQLDeprecatedDirective
212212
assert get_directive("deprecated") is not None
213213

214-
def overriding_skip_directive_excludes_built_in_one():
215-
sdl = dedent(
216-
"""
217-
directive @skip on FIELD
218-
219-
type Query {
220-
str: String
221-
}
222-
"""
223-
)
224-
schema = build_schema(sdl)
225-
assert len(schema.directives) == 3
226-
assert schema.get_directive("skip") is not GraphQLSkipDirective
227-
assert schema.get_directive("skip") is not None
228-
assert schema.get_directive("include") is GraphQLIncludeDirective
229-
assert schema.get_directive("deprecated") is GraphQLDeprecatedDirective
230-
231214
def adding_directives_maintains_skip_and_include_directives():
232-
sdl = dedent(
215+
schema = build_schema(
233216
"""
234217
directive @foo(arg: Int) on FIELD
235218
@@ -238,7 +221,7 @@ def adding_directives_maintains_skip_and_include_directives():
238221
}
239222
"""
240223
)
241-
schema = build_schema(sdl)
224+
242225
assert len(schema.directives) == 4
243226
assert schema.get_directive("skip") is GraphQLSkipDirective
244227
assert schema.get_directive("include") is GraphQLIncludeDirective

0 commit comments

Comments
 (0)