@@ -211,16 +211,16 @@ def foo(bar):
211211 p2 .new_attr = 'spam'
212212 self .assertEqual (p2 .new_attr , 'spam' )
213213
214- # def test_placeholders_trailing_trim (self):
215- # PH = self.module.Placeholder
216- # for args, call_args, expected_args in [
217- # [(PH,), (), ()],
218- # [(0, PH), (), (0,)],
219- # [(0, PH, 1 , PH, PH, PH ), (2, ), (0, 2, 1 )]
220- # ]:
221- # actual_args, actual_kwds = self.partial(capture, *args)(*call_args)
222- # self.assertEqual(actual_args, expected_args)
223- # self.assertEqual(actual_kwds, {})
214+ def test_trailing_placeholders (self ):
215+ PH = self .module .Placeholder
216+ for args , call_args , expected_args in [
217+ [(PH ,), (1 , ), (1 , )],
218+ [(0 , PH ), (1 , ), (0 , 1 )],
219+ [(0 , PH , 2 , PH , PH ), (1 , 3 , 4 ), (0 , 1 , 2 , 3 , 4 )]
220+ ]:
221+ actual_args , actual_kwds = self .partial (capture , * args )(* call_args )
222+ self .assertEqual (actual_args , expected_args )
223+ self .assertEqual (actual_kwds , {})
224224
225225 def test_placeholders (self ):
226226 PH = self .module .Placeholder
@@ -373,12 +373,6 @@ def test_setstate(self):
373373 f ()
374374 self .assertEqual (f (2 ), ((2 , 1 ), dict (a = 10 )))
375375
376- # # Trailing Placeholder error
377- # f = self.partial(signature)
378- # msg_regex = re.escape("unexpected trailing Placeholders")
379- # with self.assertRaisesRegex(TypeError, f'^{msg_regex}$') as cm:
380- # f.__setstate__((capture, (1, PH), dict(a=10), dict(attr=[])))
381-
382376 def test_setstate_errors (self ):
383377 f = self .partial (signature )
384378 self .assertRaises (TypeError , f .__setstate__ , (capture , (), {}))
0 commit comments