summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_functools.py
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na92@gmail.com>2018-07-10 07:26:36 (GMT)
committerINADA Naoki <methane@users.noreply.github.com>2018-07-10 07:26:36 (GMT)
commit445f1b35ce8461268438c8a6b327ddc764287e05 (patch)
tree7946f28321ff39563a8200ed7705a600f7ab521a /Lib/test/test_functools.py
parent7762e4d3872818272800dfbd8e1d8e3a689eb8f2 (diff)
downloadcpython-445f1b35ce8461268438c8a6b327ddc764287e05.zip
cpython-445f1b35ce8461268438c8a6b327ddc764287e05.tar.gz
cpython-445f1b35ce8461268438c8a6b327ddc764287e05.tar.bz2
bpo-33967: Fix singledispatch raised IndexError when no args (GH-8184)
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 7ffe000..f9f96ba 100644
--- a/Lib/test/test_functools.py
+++ b/Lib/test/test_functools.py
@@ -2305,6 +2305,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()