summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_math.py
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2019-02-10 19:56:58 (GMT)
committerGitHub <noreply@github.com>2019-02-10 19:56:58 (GMT)
commit4207907c2b8c0b3da62de2acdb8b22b5bbe7f7a2 (patch)
treeef4afcf1790d3e2e9e6d4573c87c0d46cf5f51b7 /Lib/test/test_math.py
parent181835d5a9bffee247bc2f7eefc778c1812bc982 (diff)
downloadcpython-4207907c2b8c0b3da62de2acdb8b22b5bbe7f7a2.zip
cpython-4207907c2b8c0b3da62de2acdb8b22b5bbe7f7a2.tar.gz
cpython-4207907c2b8c0b3da62de2acdb8b22b5bbe7f7a2.tar.bz2
Fix division by 0 when checking for overflow in math.prod (GH-11808)
Diffstat (limited to 'Lib/test/test_math.py')
-rw-r--r--Lib/test/test_math.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py
index 083759ca..856b1e8 100644
--- a/Lib/test/test_math.py
+++ b/Lib/test/test_math.py
@@ -1756,6 +1756,10 @@ class IsCloseTests(unittest.TestCase):
with self.assertRaises(TypeError):
prod([10, 20], [30, 40]) # start is a keyword-only argument
+ self.assertEqual(prod([0, 1, 2, 3]), 0)
+ self.assertEqual(prod([1, 0, 2, 3]), 0)
+ self.assertEqual(prod(range(10)), 0)
+
def test_main():
from doctest import DocFileSuite
suite = unittest.TestSuite()