summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2019-06-08 15:58:11 (GMT)
committerGitHub <noreply@github.com>2019-06-08 15:58:11 (GMT)
commite119b3d136bd94d880bce4b382096f6de3f38062 (patch)
tree241356f01ba320f5b0b342e004902e1e40314a17 /Lib/test
parent8cc605acdda5aff250ab4c9b524a7560f90ca9f3 (diff)
downloadcpython-e119b3d136bd94d880bce4b382096f6de3f38062.zip
cpython-e119b3d136bd94d880bce4b382096f6de3f38062.tar.gz
cpython-e119b3d136bd94d880bce4b382096f6de3f38062.tar.bz2
bpo-37178: Allow a one argument form of math.perm() (GH-13905)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_math.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py
index 86e3923..adefa07 100644
--- a/Lib/test/test_math.py
+++ b/Lib/test/test_math.py
@@ -1885,8 +1885,13 @@ class IsCloseTests(unittest.TestCase):
self.assertEqual(perm(n, 1), n)
self.assertEqual(perm(n, n), factorial(n))
+ # Test one argument form
+ for n in range(20):
+ self.assertEqual(perm(n), factorial(n))
+ self.assertEqual(perm(n, None), factorial(n))
+
# Raises TypeError if any argument is non-integer or argument count is
- # not 2
+ # not 1 or 2
self.assertRaises(TypeError, perm, 10, 1.0)
self.assertRaises(TypeError, perm, 10, decimal.Decimal(1.0))
self.assertRaises(TypeError, perm, 10, "1")
@@ -1894,7 +1899,7 @@ class IsCloseTests(unittest.TestCase):
self.assertRaises(TypeError, perm, decimal.Decimal(10.0), 1)
self.assertRaises(TypeError, perm, "10", 1)
- self.assertRaises(TypeError, perm, 10)
+ self.assertRaises(TypeError, perm)
self.assertRaises(TypeError, perm, 10, 1, 3)
self.assertRaises(TypeError, perm)