@@ -110,8 +110,14 @@ def directive_node(name, arguments, loc):
110
110
111
111
def describe_schema_parser ():
112
112
def simple_type ():
113
- body = "\n type Hello {\n world: String\n }"
114
- definition = assert_definitions (body , (0 , 31 ))
113
+ body = dedent (
114
+ """
115
+ type Hello {
116
+ world: String
117
+ }
118
+ """
119
+ )
120
+ definition = assert_definitions (body , (0 , 32 ))
115
121
assert isinstance (definition , ObjectTypeDefinitionNode )
116
122
assert definition .name == name_node ("Hello" , (6 , 11 ))
117
123
assert definition .description is None
@@ -125,8 +131,15 @@ def simple_type():
125
131
assert definition .loc == (1 , 31 )
126
132
127
133
def parses_type_with_description_string ():
128
- body = '\n "Description"\n type Hello {\n world: String\n }'
129
- definition = assert_definitions (body , (0 , 45 ))
134
+ body = dedent (
135
+ """
136
+ "Description"
137
+ type Hello {
138
+ world: String
139
+ }
140
+ """
141
+ )
142
+ definition = assert_definitions (body , (0 , 46 ))
130
143
assert isinstance (definition , ObjectTypeDefinitionNode )
131
144
assert definition .name == name_node ("Hello" , (20 , 25 ))
132
145
description = definition .description
@@ -156,7 +169,13 @@ def parses_type_with_description_multi_line_string():
156
169
assert description .loc == (1 , 20 )
157
170
158
171
def simple_extension ():
159
- body = "\n extend type Hello {\n world: String\n }\n "
172
+ body = dedent (
173
+ """
174
+ extend type Hello {
175
+ world: String
176
+ }
177
+ """
178
+ )
160
179
extension = assert_definitions (body , (0 , 39 ))
161
180
assert isinstance (extension , ObjectTypeExtensionNode )
162
181
assert extension .name == name_node ("Hello" , (13 , 18 ))
@@ -261,8 +280,14 @@ def schema_extension_without_anything_throws():
261
280
assert_syntax_error ("extend schema" , "Unexpected <EOF>" , (1 , 14 ))
262
281
263
282
def simple_non_null_type ():
264
- body = "\n type Hello {\n world: String!\n }"
265
- definition = assert_definitions (body , (0 , 32 ))
283
+ body = dedent (
284
+ """
285
+ type Hello {
286
+ world: String!
287
+ }
288
+ """
289
+ )
290
+ definition = assert_definitions (body , (0 , 33 ))
266
291
assert isinstance (definition , ObjectTypeDefinitionNode )
267
292
assert definition .name == name_node ("Hello" , (6 , 11 ))
268
293
assert definition .description is None
@@ -352,8 +377,14 @@ def double_value_enum():
352
377
assert definition .loc == (0 , 22 )
353
378
354
379
def simple_interface ():
355
- body = "\n interface Hello {\n world: String\n }"
356
- definition = assert_definitions (body , (0 , 36 ))
380
+ body = dedent (
381
+ """
382
+ interface Hello {
383
+ world: String
384
+ }
385
+ """
386
+ )
387
+ definition = assert_definitions (body , (0 , 37 ))
357
388
assert isinstance (definition , InterfaceTypeDefinitionNode )
358
389
assert definition .name == name_node ("Hello" , (11 , 16 ))
359
390
assert definition .description is None
@@ -366,8 +397,14 @@ def simple_interface():
366
397
assert definition .loc == (1 , 36 )
367
398
368
399
def simple_field_with_arg ():
369
- body = "\n type Hello {\n world(flag: Boolean): String\n }"
370
- definition = assert_definitions (body , (0 , 46 ))
400
+ body = dedent (
401
+ """
402
+ type Hello {
403
+ world(flag: Boolean): String
404
+ }
405
+ """
406
+ )
407
+ definition = assert_definitions (body , (0 , 47 ))
371
408
assert isinstance (definition , ObjectTypeDefinitionNode )
372
409
assert definition .name == name_node ("Hello" , (6 , 11 ))
373
410
assert definition .description is None
@@ -391,8 +428,14 @@ def simple_field_with_arg():
391
428
assert definition .loc == (1 , 46 )
392
429
393
430
def simple_field_with_arg_with_default_value ():
394
- body = "\n type Hello {\n world(flag: Boolean = true): String\n }"
395
- definition = assert_definitions (body , (0 , 53 ))
431
+ body = dedent (
432
+ """
433
+ type Hello {
434
+ world(flag: Boolean = true): String
435
+ }
436
+ """
437
+ )
438
+ definition = assert_definitions (body , (0 , 54 ))
396
439
assert isinstance (definition , ObjectTypeDefinitionNode )
397
440
assert definition .name == name_node ("Hello" , (6 , 11 ))
398
441
assert definition .description is None
@@ -416,8 +459,14 @@ def simple_field_with_arg_with_default_value():
416
459
assert definition .loc == (1 , 53 )
417
460
418
461
def simple_field_with_list_arg ():
419
- body = "\n type Hello {\n world(things: [String]): String\n }"
420
- definition = assert_definitions (body , (0 , 49 ))
462
+ body = dedent (
463
+ """
464
+ type Hello {
465
+ world(things: [String]): String
466
+ }
467
+ """
468
+ )
469
+ definition = assert_definitions (body , (0 , 50 ))
421
470
assert isinstance (definition , ObjectTypeDefinitionNode )
422
471
assert definition .name == name_node ("Hello" , (6 , 11 ))
423
472
assert definition .description is None
@@ -441,8 +490,14 @@ def simple_field_with_list_arg():
441
490
assert definition .loc == (1 , 49 )
442
491
443
492
def simple_field_with_two_args ():
444
- body = "\n type Hello {\n world(argOne: Boolean, argTwo: Int): String\n }"
445
- definition = assert_definitions (body , (0 , 61 ))
493
+ body = dedent (
494
+ """
495
+ type Hello {
496
+ world(argOne: Boolean, argTwo: Int): String
497
+ }
498
+ """
499
+ )
500
+ definition = assert_definitions (body , (0 , 62 ))
446
501
assert isinstance (definition , ObjectTypeDefinitionNode )
447
502
assert definition .name == name_node ("Hello" , (6 , 11 ))
448
503
assert definition .description is None
0 commit comments