@@ -153,31 +153,29 @@ def test_boolean_non_null_boolean_in_directive_with_default():
153
153
154
154
def test_int_non_null_int ():
155
155
expect_fails_rule (VariablesInAllowedPosition , '''
156
- query Query($intArg: Int)
157
- {
156
+ query Query($intArg: Int) {
158
157
complicatedArgs {
159
158
nonNullIntArgField(nonNullIntArg: $intArg)
160
159
}
161
160
}
162
161
''' , [
163
162
{ 'message' : VariablesInAllowedPosition .bad_var_pos_message ('intArg' , 'Int' , 'Int!' ),
164
- 'locations' : [SourceLocation (5 , 45 )] }
163
+ 'locations' : [SourceLocation (4 , 45 ), SourceLocation ( 2 , 19 )] }
165
164
])
166
165
167
166
def test_int_non_null_int_within_fragment ():
168
167
expect_fails_rule (VariablesInAllowedPosition , '''
169
168
fragment nonNullIntArgFieldFrag on ComplicatedArgs {
170
169
nonNullIntArgField(nonNullIntArg: $intArg)
171
170
}
172
- query Query($intArg: Int)
173
- {
171
+ query Query($intArg: Int) {
174
172
complicatedArgs {
175
173
...nonNullIntArgFieldFrag
176
174
}
177
175
}
178
176
''' , [
179
177
{ 'message' : VariablesInAllowedPosition .bad_var_pos_message ('intArg' , 'Int' , 'Int!' ),
180
- 'locations' : [SourceLocation (3 , 43 )] }
178
+ 'locations' : [SourceLocation (5 , 19 ), SourceLocation ( 3 , 43 )] }
181
179
])
182
180
183
181
def test_int_non_null_int_within_nested_fragment ():
@@ -188,61 +186,56 @@ def test_int_non_null_int_within_nested_fragment():
188
186
fragment nonNullIntArgFieldFrag on ComplicatedArgs {
189
187
nonNullIntArgField(nonNullIntArg: $intArg)
190
188
}
191
- query Query($intArg: Int)
192
- {
189
+ query Query($intArg: Int) {
193
190
complicatedArgs {
194
191
...outerFrag
195
192
}
196
193
}
197
194
''' , [
198
195
{ 'message' : VariablesInAllowedPosition .bad_var_pos_message ('intArg' , 'Int' , 'Int!' ),
199
- 'locations' : [SourceLocation (6 , 43 )] }
196
+ 'locations' : [SourceLocation (8 , 19 ), SourceLocation ( 6 , 43 )] }
200
197
])
201
198
202
199
def test_string_over_boolean ():
203
200
expect_fails_rule (VariablesInAllowedPosition , '''
204
- query Query($stringVar: String)
205
- {
201
+ query Query($stringVar: String) {
206
202
complicatedArgs {
207
203
booleanArgField(booleanArg: $stringVar)
208
204
}
209
205
}
210
206
''' , [
211
207
{ 'message' : VariablesInAllowedPosition .bad_var_pos_message ('stringVar' , 'String' , 'Boolean' ),
212
- 'locations' : [SourceLocation (5 , 39 )] }
208
+ 'locations' : [SourceLocation (2 , 19 ), SourceLocation ( 4 , 39 )] }
213
209
])
214
210
215
211
def test_string_string_fail ():
216
212
expect_fails_rule (VariablesInAllowedPosition , '''
217
- query Query($stringVar: String)
218
- {
213
+ query Query($stringVar: String) {
219
214
complicatedArgs {
220
215
stringListArgField(stringListArg: $stringVar)
221
216
}
222
217
}
223
218
''' , [
224
219
{ 'message' : VariablesInAllowedPosition .bad_var_pos_message ('stringVar' , 'String' , '[String]' ),
225
- 'locations' : [SourceLocation (5 , 45 )]}
220
+ 'locations' : [SourceLocation (2 , 19 ), SourceLocation ( 4 , 45 )]}
226
221
])
227
222
228
223
def test_boolean_non_null_boolean_in_directive ():
229
224
expect_fails_rule (VariablesInAllowedPosition , '''
230
- query Query($boolVar: Boolean)
231
- {
225
+ query Query($boolVar: Boolean) {
232
226
dog @include(if: $boolVar)
233
227
}
234
228
''' , [
235
229
{ 'message' : VariablesInAllowedPosition .bad_var_pos_message ('boolVar' , 'Boolean' , 'Boolean!' ),
236
- 'locations' : [SourceLocation (4 , 26 )]
230
+ 'locations' : [SourceLocation (2 , 19 ), SourceLocation ( 3 , 26 )]
237
231
}])
238
232
239
233
def test_string_non_null_boolean_in_directive ():
240
234
expect_fails_rule (VariablesInAllowedPosition , '''
241
- query Query($stringVar: String)
242
- {
235
+ query Query($stringVar: String) {
243
236
dog @include(if: $stringVar)
244
237
}
245
238
''' , [
246
239
{ 'message' : VariablesInAllowedPosition .bad_var_pos_message ('stringVar' , 'String' , 'Boolean!' ),
247
- 'locations' : [SourceLocation (4 , 26 )] }
240
+ 'locations' : [SourceLocation (2 , 19 ), SourceLocation ( 3 , 26 )] }
248
241
])
0 commit comments