@@ -194,16 +194,19 @@ def test___qualname__(self):
194194 def test___type_params__ (self ):
195195 def generic [T ](): pass
196196 def not_generic (): pass
197+ lambda_ = lambda : ...
197198 T , = generic .__type_params__
198199 self .assertIsInstance (T , typing .TypeVar )
199200 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 ,))
207210
208211 def test___code__ (self ):
209212 num_one , num_two = 7 , 8
0 commit comments