diff options
Diffstat (limited to 'Lib/test/test_keywordonlyarg.py')
-rw-r--r-- | Lib/test/test_keywordonlyarg.py | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/Lib/test/test_keywordonlyarg.py b/Lib/test/test_keywordonlyarg.py index d82e33d973..2cf8a89a07 100644 --- a/Lib/test/test_keywordonlyarg.py +++ b/Lib/test/test_keywordonlyarg.py @@ -51,24 +51,12 @@ class KeywordOnlyArgTestCase(unittest.TestCase): self.assertRaisesSyntaxError("def f(p, *, (k1, k2), **kw):\n pass\n") def testSyntaxForManyArguments(self): - fundef = "def f(" - for i in range(255): - fundef += "i%d, "%i - fundef += "*, key=100):\n pass\n" - self.assertRaisesSyntaxError(fundef) - - fundef2 = "def foo(i,*," - for i in range(255): - fundef2 += "i%d, "%i - fundef2 += "lastarg):\n pass\n" - self.assertRaisesSyntaxError(fundef2) - - # exactly 255 arguments, should compile ok - fundef3 = "def f(i,*," - for i in range(253): - fundef3 += "i%d, "%i - fundef3 += "lastarg):\n pass\n" - compile(fundef3, "<test>", "single") + # more than 255 positional arguments, should compile ok + fundef = "def f(%s):\n pass\n" % ', '.join('i%d' % i for i in range(300)) + compile(fundef, "<test>", "single") + # more than 255 keyword-only arguments, should compile ok + fundef = "def f(*, %s):\n pass\n" % ', '.join('i%d' % i for i in range(300)) + compile(fundef, "<test>", "single") def testTooManyPositionalErrorMessage(self): def f(a, b=None, *, c=None): |