File tree 1 file changed +10
-0
lines changed
Filter options
1 file changed +10
-0
lines changed
Original file line number Diff line number Diff line change @@ -220,28 +220,38 @@ def __class_getitem__(cls):
220
220
return None
221
221
with self .assertRaises (TypeError ):
222
222
C_too_few [int ]
223
+
223
224
class C_too_many :
224
225
def __class_getitem__ (cls , one , two ):
225
226
return None
226
227
with self .assertRaises (TypeError ):
227
228
C_too_many [int ]
228
229
230
+ # TODO: RUSTPYTHON
231
+ @unittest .expectedFailure
229
232
def test_class_getitem_errors_2 (self ):
230
233
class C :
231
234
def __class_getitem__ (cls , item ):
232
235
return None
233
236
with self .assertRaises (TypeError ):
234
237
C ()[int ]
238
+
235
239
class E : ...
236
240
e = E ()
237
241
e .__class_getitem__ = lambda cls , item : 'This will not work'
238
242
with self .assertRaises (TypeError ):
239
243
e [int ]
244
+
240
245
class C_not_callable :
241
246
__class_getitem__ = "Surprise!"
242
247
with self .assertRaises (TypeError ):
243
248
C_not_callable [int ]
244
249
250
+ class C_is_none (tuple ):
251
+ __class_getitem__ = None
252
+ with self .assertRaisesRegex (TypeError , "C_is_none" ):
253
+ C_is_none [int ]
254
+
245
255
def test_class_getitem_metaclass (self ):
246
256
class Meta (type ):
247
257
def __class_getitem__ (cls , item ):
You can’t perform that action at this time.
0 commit comments