diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2019-06-17 13:58:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-17 13:58:32 (GMT) |
commit | 1b8a46d59734a77cd1f5ffcf3bdfcaafd58a87e7 (patch) | |
tree | 2bd7bc34cc2266ff7002f7f1baf38e8f772b2eac | |
parent | 231aad38493c871dd32930a21d256cbacd2ae20c (diff) | |
download | cpython-1b8a46d59734a77cd1f5ffcf3bdfcaafd58a87e7.zip cpython-1b8a46d59734a77cd1f5ffcf3bdfcaafd58a87e7.tar.gz cpython-1b8a46d59734a77cd1f5ffcf3bdfcaafd58a87e7.tar.bz2 |
bpo-35431: Test math.comb() and math.perm() for OverflowError only on CPython. (GH-14146)
Other implementation can raise MemoryError, but it can takes hours.
-rw-r--r-- | Lib/test/test_math.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py index f259139..fa69044 100644 --- a/Lib/test/test_math.py +++ b/Lib/test/test_math.py @@ -525,7 +525,7 @@ class MathTests(unittest.TestCase): # Other implementations may place different upper bounds. @support.cpython_only def testFactorialHugeInputs(self): - # Currently raises ValueError for inputs that are too large + # Currently raises OverflowError for inputs that are too large # to fit into a C long. self.assertRaises(OverflowError, math.factorial, 10**100) with self.assertWarns(DeprecationWarning): @@ -1922,7 +1922,8 @@ class IsCloseTests(unittest.TestCase): self.assertEqual(perm(n, 0), 1) self.assertEqual(perm(n, 1), n) self.assertEqual(perm(n, 2), n * (n-1)) - self.assertRaises((OverflowError, MemoryError), perm, n, n) + if support.check_impl_detail(cpython=True): + self.assertRaises(OverflowError, perm, n, n) for n, k in (True, True), (True, False), (False, False): self.assertEqual(perm(n, k), 1) @@ -1991,7 +1992,8 @@ class IsCloseTests(unittest.TestCase): self.assertEqual(comb(n, n), 1) self.assertEqual(comb(n, n-1), n) self.assertEqual(comb(n, n-2), n * (n-1) // 2) - self.assertRaises((OverflowError, MemoryError), comb, n, n//2) + if support.check_impl_detail(cpython=True): + self.assertRaises(OverflowError, comb, n, n//2) for n, k in (True, True), (True, False), (False, False): self.assertEqual(comb(n, k), 1) |