@@ -194,16 +194,19 @@ def test___qualname__(self):
194
194
def test___type_params__ (self ):
195
195
def generic [T ](): pass
196
196
def not_generic (): pass
197
+ lambda_ = lambda : ...
197
198
T , = generic .__type_params__
198
199
self .assertIsInstance (T , typing .TypeVar )
199
200
self .assertEqual (generic .__type_params__ , (T ,))
200
- self .assertEqual (not_generic .__type_params__ , ())
201
- with self .assertRaises (TypeError ):
202
- del not_generic .__type_params__
203
- with self .assertRaises (TypeError ):
204
- not_generic .__type_params__ = 42
205
- not_generic .__type_params__ = (T ,)
206
- self .assertEqual (not_generic .__type_params__ , (T ,))
201
+ for func in (not_generic , lambda_ ):
202
+ with self .subTest (func = func ):
203
+ self .assertEqual (func .__type_params__ , ())
204
+ with self .assertRaises (TypeError ):
205
+ del func .__type_params__
206
+ with self .assertRaises (TypeError ):
207
+ func .__type_params__ = 42
208
+ func .__type_params__ = (T ,)
209
+ self .assertEqual (func .__type_params__ , (T ,))
207
210
208
211
def test___code__ (self ):
209
212
num_one , num_two = 7 , 8
0 commit comments