summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_functools.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-07-10 07:48:57 (GMT)
committerGitHub <noreply@github.com>2018-07-10 07:48:57 (GMT)
commitdf9f633f94e97fc43e0235cb2be076491ea7f67f (patch)
tree7f9eb16b48e04c3cf717003bdfc4a95b7c17d70b /Lib/test/test_functools.py
parentc3bdea4c6ca8861e144802b8e319fe266941790f (diff)
downloadcpython-df9f633f94e97fc43e0235cb2be076491ea7f67f.zip
cpython-df9f633f94e97fc43e0235cb2be076491ea7f67f.tar.gz
cpython-df9f633f94e97fc43e0235cb2be076491ea7f67f.tar.bz2
bpo-33967: Fix singledispatch raised IndexError when no args (GH-8184)
(cherry picked from commit 445f1b35ce8461268438c8a6b327ddc764287e05) Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
Diffstat (limited to 'Lib/test/test_functools.py')
-rw-r--r--Lib/test/test_functools.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py
index 2245b97..e325480 100644
--- a/Lib/test/test_functools.py
+++ b/Lib/test/test_functools.py
@@ -2187,6 +2187,13 @@ class TestSingleDispatch(unittest.TestCase):
))
self.assertTrue(str(exc.exception).endswith(msg_suffix))
+ def test_invalid_positional_argument(self):
+ @functools.singledispatch
+ def f(*args):
+ pass
+ msg = 'f requires at least 1 positional argument'
+ with self.assertRaisesRegexp(TypeError, msg):
+ f()
if __name__ == '__main__':
unittest.main()