@@ -37,41 +37,41 @@ def serializes_output_as_int():
37
37
assert str (exc_info .value ) == "Int cannot represent non-integer value: '-1.1'"
38
38
# Maybe a safe JavaScript int, but bigger than 2^32, so not
39
39
# representable as a GraphQL Int
40
- with raises (Exception ) as exc_info :
40
+ with raises (TypeError ) as exc_info :
41
41
GraphQLInt .serialize (9876504321 )
42
42
assert str (exc_info .value ) == (
43
43
"Int cannot represent non 32-bit signed integer value: 9876504321"
44
44
)
45
- with raises (Exception ) as exc_info :
45
+ with raises (TypeError ) as exc_info :
46
46
GraphQLInt .serialize (- 9876504321 )
47
47
assert str (exc_info .value ) == (
48
48
"Int cannot represent non 32-bit signed integer value: -9876504321"
49
49
)
50
50
# Too big to represent as an Int in JavaScript or GraphQL
51
- with raises (Exception ) as exc_info :
51
+ with raises (TypeError ) as exc_info :
52
52
GraphQLInt .serialize (1e100 )
53
53
assert str (exc_info .value ) == (
54
54
"Int cannot represent non 32-bit signed integer value: 1e+100"
55
55
)
56
- with raises (Exception ) as exc_info :
56
+ with raises (TypeError ) as exc_info :
57
57
GraphQLInt .serialize (- 1e100 )
58
58
assert str (exc_info .value ) == (
59
59
"Int cannot represent non 32-bit signed integer value: -1e+100"
60
60
)
61
- with raises (Exception ) as exc_info :
61
+ with raises (TypeError ) as exc_info :
62
62
GraphQLInt .serialize ("one" )
63
63
assert str (exc_info .value ) == "Int cannot represent non-integer value: 'one'"
64
64
# Doesn't represent number
65
- with raises (Exception ) as exc_info :
65
+ with raises (TypeError ) as exc_info :
66
66
GraphQLInt .serialize ("" )
67
67
assert str (exc_info .value ) == "Int cannot represent non-integer value: ''"
68
- with raises (Exception ) as exc_info :
68
+ with raises (TypeError ) as exc_info :
69
69
GraphQLInt .serialize (nan )
70
70
assert str (exc_info .value ) == "Int cannot represent non-integer value: nan"
71
- with raises (Exception ) as exc_info :
71
+ with raises (TypeError ) as exc_info :
72
72
GraphQLInt .serialize (inf )
73
73
assert str (exc_info .value ) == "Int cannot represent non-integer value: inf"
74
- with raises (Exception ) as exc_info :
74
+ with raises (TypeError ) as exc_info :
75
75
GraphQLInt .serialize ([5 ])
76
76
assert str (exc_info .value ) == "Int cannot represent non-integer value: [5]"
77
77
@@ -87,21 +87,21 @@ def serializes_output_as_float():
87
87
assert GraphQLFloat .serialize (False ) == 0
88
88
assert GraphQLFloat .serialize (True ) == 1
89
89
90
- with raises (Exception ) as exc_info :
90
+ with raises (TypeError ) as exc_info :
91
91
GraphQLFloat .serialize (nan )
92
92
assert str (exc_info .value ) == "Float cannot represent non numeric value: nan"
93
- with raises (Exception ) as exc_info :
93
+ with raises (TypeError ) as exc_info :
94
94
GraphQLFloat .serialize (inf )
95
95
assert str (exc_info .value ) == "Float cannot represent non numeric value: inf"
96
- with raises (Exception ) as exc_info :
96
+ with raises (TypeError ) as exc_info :
97
97
GraphQLFloat .serialize ("one" )
98
98
assert str (exc_info .value ) == (
99
99
"Float cannot represent non numeric value: 'one'"
100
100
)
101
- with raises (Exception ) as exc_info :
101
+ with raises (TypeError ) as exc_info :
102
102
GraphQLFloat .serialize ("" )
103
103
assert str (exc_info .value ) == "Float cannot represent non numeric value: ''"
104
- with raises (Exception ) as exc_info :
104
+ with raises (TypeError ) as exc_info :
105
105
GraphQLFloat .serialize ([5 ])
106
106
assert str (exc_info .value ) == "Float cannot represent non numeric value: [5]"
107
107
@@ -118,15 +118,15 @@ def __str__(self):
118
118
119
119
assert GraphQLString .serialize (StringableObjValue ()) == "something useful"
120
120
121
- with raises (Exception ) as exc_info :
121
+ with raises (TypeError ) as exc_info :
122
122
GraphQLString .serialize (nan )
123
123
assert str (exc_info .value ) == "String cannot represent value: nan"
124
124
125
- with raises (Exception ) as exc_info :
125
+ with raises (TypeError ) as exc_info :
126
126
GraphQLString .serialize ([1 ])
127
127
assert str (exc_info .value ) == "String cannot represent value: [1]"
128
128
129
- with raises (Exception ) as exc_info :
129
+ with raises (TypeError ) as exc_info :
130
130
GraphQLString .serialize ({})
131
131
assert str (exc_info .value ) == "String cannot represent value: {}"
132
132
@@ -136,31 +136,31 @@ def serializes_output_as_boolean():
136
136
assert GraphQLBoolean .serialize (True ) is True
137
137
assert GraphQLBoolean .serialize (False ) is False
138
138
139
- with raises (Exception ) as exc_info :
139
+ with raises (TypeError ) as exc_info :
140
140
GraphQLBoolean .serialize (nan )
141
141
assert str (exc_info .value ) == (
142
142
"Boolean cannot represent a non boolean value: nan"
143
143
)
144
144
145
- with raises (Exception ) as exc_info :
145
+ with raises (TypeError ) as exc_info :
146
146
GraphQLBoolean .serialize ("" )
147
147
assert str (exc_info .value ) == (
148
148
"Boolean cannot represent a non boolean value: ''"
149
149
)
150
150
151
- with raises (Exception ) as exc_info :
151
+ with raises (TypeError ) as exc_info :
152
152
GraphQLBoolean .serialize ("True" )
153
153
assert str (exc_info .value ) == (
154
154
"Boolean cannot represent a non boolean value: 'True'"
155
155
)
156
156
157
- with raises (Exception ) as exc_info :
157
+ with raises (TypeError ) as exc_info :
158
158
GraphQLBoolean .serialize ([False ])
159
159
assert str (exc_info .value ) == (
160
160
"Boolean cannot represent a non boolean value: [False]"
161
161
)
162
162
163
- with raises (Exception ) as exc_info :
163
+ with raises (TypeError ) as exc_info :
164
164
GraphQLBoolean .serialize ({})
165
165
assert str (exc_info .value ) == (
166
166
"Boolean cannot represent a non boolean value: {}"
@@ -184,18 +184,18 @@ def __str__(self):
184
184
obj_value = ObjValue (123 )
185
185
assert GraphQLID .serialize (obj_value ) == "123"
186
186
187
- with raises (Exception ) as exc_info :
187
+ with raises (TypeError ) as exc_info :
188
188
GraphQLID .serialize (True )
189
189
assert str (exc_info .value ) == "ID cannot represent value: True"
190
190
191
- with raises (Exception ) as exc_info :
191
+ with raises (TypeError ) as exc_info :
192
192
GraphQLID .serialize (3.14 )
193
193
assert str (exc_info .value ) == ("ID cannot represent value: 3.14" )
194
194
195
- with raises (Exception ) as exc_info :
195
+ with raises (TypeError ) as exc_info :
196
196
GraphQLID .serialize ({})
197
197
assert str (exc_info .value ) == ("ID cannot represent value: {}" )
198
198
199
- with raises (Exception ) as exc_info :
199
+ with raises (TypeError ) as exc_info :
200
200
GraphQLID .serialize (["abc" ])
201
201
assert str (exc_info .value ) == ("ID cannot represent value: ['abc']" )
0 commit comments