diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2011-05-07 18:15:34 +0300 |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2011-05-07 18:15:34 +0300 |
commit | 17736f19671fe9e3a1d0965abf6e0d022c3c7b7f (patch) | |
tree | 53cdecfea95a81b6ef7326980cf5e81328b32b06 /Lib/test/test_keywordonlyarg.py | |
parent | 2c515bbdb8fc7fd4cc3d01151d0b8dd8d5adccfd (diff) | |
parent | 496564fe5be17057671a373f4a1126352823ece5 (diff) | |
download | cpython-17736f19671fe9e3a1d0965abf6e0d022c3c7b7f.tar.gz |
#12017: merge with 3.1.
Diffstat (limited to 'Lib/test/test_keywordonlyarg.py')
-rw-r--r-- | Lib/test/test_keywordonlyarg.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/test/test_keywordonlyarg.py b/Lib/test/test_keywordonlyarg.py index e10dfce2ad..d7f7541837 100644 --- a/Lib/test/test_keywordonlyarg.py +++ b/Lib/test/test_keywordonlyarg.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """Unit tests for the keyword only argument specified in PEP 3102.""" @@ -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)") |