@@ -10,87 +10,192 @@ def bad_value(arg_name, type_name, value, line, column):
10
10
}
11
11
12
12
13
- def test_good_int_value ():
14
- expect_passes_rule (ArgumentsOfCorrectType , '''
15
- {
16
- complicatedArgs {
17
- intArgField(intArg: 2)
13
+ # noinspection PyMethodMayBeStatic
14
+ class TestValidValues (object ):
15
+ def test_good_int_value (self ):
16
+ expect_passes_rule (ArgumentsOfCorrectType , '''
17
+ {
18
+ complicatedArgs {
19
+ intArgField(intArg: 2)
20
+ }
18
21
}
19
- }
20
- ''' )
22
+ ''' )
23
+
24
+ def test_good_boolean_value (self ):
25
+ expect_passes_rule (ArgumentsOfCorrectType , '''
26
+ {
27
+ complicatedArgs {
28
+ booleanArgField(booleanArg: true)
29
+ }
30
+ }
31
+ ''' )
32
+
33
+ def test_good_string_value (self ):
34
+ expect_passes_rule (ArgumentsOfCorrectType , '''
35
+ {
36
+ complicatedArgs {
37
+ stringArgField(stringArg: "foo")
38
+ }
39
+ }
40
+ ''' )
41
+
42
+ def test_good_float_value (self ):
43
+ expect_passes_rule (ArgumentsOfCorrectType , '''
44
+ {
45
+ complicatedArgs {
46
+ floatArgField(floatArg: 1.1)
47
+ }
48
+ }
49
+ ''' )
50
+
51
+ def test_int_into_float (self ):
52
+ expect_passes_rule (ArgumentsOfCorrectType , '''
53
+ {
54
+ complicatedArgs {
55
+ floatArgField(floatArg: 1)
56
+ }
57
+ }
58
+ ''' )
59
+
60
+ def test_int_into_id (self ):
61
+ expect_passes_rule (ArgumentsOfCorrectType , '''
62
+ {
63
+ complicatedArgs {
64
+ idArgField(idArg: 1)
65
+ }
66
+ }
67
+ ''' )
68
+
69
+ def test_string_into_id (self ):
70
+ expect_passes_rule (ArgumentsOfCorrectType , '''
71
+ {
72
+ complicatedArgs {
73
+ idArgField(idArg: "someIdString")
74
+ }
75
+ }
76
+ ''' )
77
+
78
+ def test_good_enum_value (self ):
79
+ expect_passes_rule (ArgumentsOfCorrectType , '''
80
+ {
81
+ dog {
82
+ doesKnowCommand(dogCommand: SIT)
83
+ }
84
+ }
85
+ ''' )
21
86
22
87
23
- def test_good_boolean_value ():
24
- expect_passes_rule (ArgumentsOfCorrectType , '''
25
- {
26
- complicatedArgs {
27
- booleanArgField(booleanArg: true)
88
+ # noinspection PyMethodMayBeStatic
89
+ class TestInvalidStringValues (object ):
90
+ def test_int_into_string (self ):
91
+ expect_fails_rule (ArgumentsOfCorrectType , '''
92
+ {
93
+ complicatedArgs {
94
+ stringArgField(stringArg: 1)
95
+ }
28
96
}
29
- }
30
- ''' )
97
+ ''' , [
98
+ bad_value ('stringArg' , 'String' , '1' , 4 , 39 )
99
+ ])
100
+
101
+ def test_float_into_string (self ):
102
+ expect_fails_rule (ArgumentsOfCorrectType , '''
103
+ {
104
+ complicatedArgs {
105
+ stringArgField(stringArg: 1.0)
106
+ }
107
+ }
108
+ ''' , [
109
+ bad_value ('stringArg' , 'String' , '1.0' , 4 , 39 )
110
+ ])
111
+
112
+ def test_bool_into_string (self ):
113
+ expect_fails_rule (ArgumentsOfCorrectType , '''
114
+ {
115
+ complicatedArgs {
116
+ stringArgField(stringArg: true)
117
+ }
118
+ }
119
+ ''' , [
120
+ bad_value ('stringArg' , 'String' , 'true' , 4 , 39 )
121
+ ])
122
+
123
+ def test_unquoted_string_into_string (self ):
124
+ expect_fails_rule (ArgumentsOfCorrectType , '''
125
+ {
126
+ complicatedArgs {
127
+ stringArgField(stringArg: BAR)
128
+ }
129
+ }
130
+ ''' , [
131
+ bad_value ('stringArg' , 'String' , 'BAR' , 4 , 39 )
132
+ ])
133
+
134
+
135
+ # noinspection PyMethodMayBeStatic
136
+ class TestInvalidIntValues (object ):
137
+ def test_string_into_int (self ):
138
+ expect_fails_rule (ArgumentsOfCorrectType , '''
139
+ {
140
+ complicatedArgs {
141
+ intArgField(intArg: "3")
142
+ }
143
+ }
144
+ ''' , [
145
+ bad_value ('intArg' , 'Int' , '"3"' , 4 , 33 )
146
+ ])
31
147
32
148
33
- def test_good_string_value ():
34
- expect_passes_rule (ArgumentsOfCorrectType , '''
35
- {
36
- complicatedArgs {
37
- stringArgField(stringArg: "foo")
38
- }
39
- }
40
- ''' )
149
+ # noinspection PyMethodMayBeStatic
150
+ class TestInvalidFloatValues (object ):
151
+ pass
41
152
42
153
43
- def test_good_float_value ():
44
- expect_passes_rule (ArgumentsOfCorrectType , '''
45
- {
46
- complicatedArgs {
47
- floatArgField(floatArg: 1.1)
48
- }
49
- }
50
- ''' )
154
+ # noinspection PyMethodMayBeStatic
155
+ class TestInvalidBooleanValues (object ):
156
+ pass
51
157
52
158
53
- def test_int_into_float ():
54
- expect_passes_rule (ArgumentsOfCorrectType , '''
55
- {
56
- complicatedArgs {
57
- floatArgField(floatArg: 1)
58
- }
59
- }
60
- ''' )
159
+ # noinspection PyMethodMayBeStatic
160
+ class TestInvalidIDValues (object ):
161
+ pass
61
162
62
163
63
- def test_int_into_id ():
64
- expect_passes_rule (ArgumentsOfCorrectType , '''
65
- {
66
- complicatedArgs {
67
- idArgField(idArg: 1)
68
- }
69
- }
70
- ''' )
164
+ # noinspection PyMethodMayBeStatic
165
+ class TestInvalidEnumValues (object ):
166
+ pass
71
167
72
168
73
- def test_string_into_id ():
74
- expect_passes_rule (ArgumentsOfCorrectType , '''
75
- {
76
- complicatedArgs {
77
- idArgField(idArg: "someIdString")
78
- }
79
- }
80
- ''' )
169
+ # noinspection PyMethodMayBeStatic
170
+ class TestValidListValues (object ):
171
+ pass
81
172
82
173
83
- def test_good_enum_value ():
84
- expect_passes_rule (ArgumentsOfCorrectType , '''
85
- {
86
- dog {
87
- doesKnowCommand(dogCommand: SIT)
88
- }
89
- }
90
- ''' )
174
+ # noinspection PyMethodMayBeStatic
175
+ class TestInvalidListValues (object ):
176
+ pass
177
+
178
+
179
+ # noinspection PyMethodMayBeStatic
180
+ class TestValidNonNullableValues (object ):
181
+ pass
182
+
183
+
184
+ # noinspection PyMethodMayBeStatic
185
+ class TestInvalidNonNullableValues (object ):
186
+ pass
187
+
188
+
189
+ # noinspection PyMethodMayBeStatic
190
+ class TestValidInputObjectValue (object ):
191
+ pass
192
+
193
+
194
+ # noinspection PyMethodMayBeStatic
195
+ class TestInvalidInputObjectValue (object ):
196
+ pass
197
+
91
198
92
- #
93
- # def test_int_into_string():
94
- # expect_passes_rule(ArgumentsOfCorrectType, '''
95
- #
96
- # ''')
199
+ # noinspection PyMethodMayBeStatic
200
+ class TestDirectiveArguments (object ):
201
+ pass
0 commit comments