From b738df1cd4bcfdf6e01ea459ca559cd64f0bf6f3 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Fri, 16 Dec 2016 19:19:02 +0200 Subject: Issue #18896: Python function can now have more than 255 parameters. collections.namedtuple() now supports tuples with more than 255 elements. --- Lib/test/test_keywordonlyarg.py | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) (limited to 'Lib/test/test_keywordonlyarg.py') 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, "", "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, "", "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, "", "single") def testTooManyPositionalErrorMessage(self): def f(a, b=None, *, c=None): -- cgit v1.2.1