diff options
author | Benjamin Peterson <benjamin@python.org> | 2010-06-25 19:30:21 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2010-06-25 19:30:21 (GMT) |
commit | 88968ad380752227656e2ab4425315e474e26336 (patch) | |
tree | 87d0b51411b7c9910f96629eb1de7072b2a492a2 /Lib/test/test_keywordonlyarg.py | |
parent | 5a3ef5b22af607666111c76764db0efffbef82be (diff) | |
download | cpython-88968ad380752227656e2ab4425315e474e26336.zip cpython-88968ad380752227656e2ab4425315e474e26336.tar.gz cpython-88968ad380752227656e2ab4425315e474e26336.tar.bz2 |
only take into account positional arguments count in related error messages
Diffstat (limited to 'Lib/test/test_keywordonlyarg.py')
-rw-r--r-- | Lib/test/test_keywordonlyarg.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_keywordonlyarg.py b/Lib/test/test_keywordonlyarg.py index 6a88b3d..bdcc4c6 100644 --- a/Lib/test/test_keywordonlyarg.py +++ b/Lib/test/test_keywordonlyarg.py @@ -73,6 +73,14 @@ class KeywordOnlyArgTestCase(unittest.TestCase): fundef3 += "lastarg):\n pass\n" compile(fundef3, "<test>", "single") + def testTooManyPositionalErrorMessage(self): + def f(a, b=None, *, c=None): + pass + with self.assertRaises(TypeError) as exc: + f(1, 2, 3) + expected = "f() takes at most 2 positional arguments (3 given)" + self.assertEqual(str(exc.exception), expected) + def testSyntaxErrorForFunctionCall(self): self.assertRaisesSyntaxError("f(p, k=1, p2)") self.assertRaisesSyntaxError("f(p, k1=50, *(1,2), k1=100)") |