[3.14] gh-149221: Add missing `test_binomialvariate_log_zero` (#154879)
hugovk <[email protected]> Wed, 29 Jul 2026 12:37:10 -0400 (EDT)
| Newsgroups | gmane.comp.python.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://github.com/python/cpython/commit/2946c544ead6630df8c2f37de4a1248528e65d81 commit: 2946c544ead6630df8c2f37de4a1248528e65d81 branch: 3.14 author: Hugo van Kemenade <[email protected]> committer: hugovk <[email protected]> date: 2026-07-29T19:36:53+03:00 summary: [3.14] gh-149221: Add missing `test_binomialvariate_log_zero` (#154879) files: M Lib/test/test_random.py diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py index 3739fe0ac393b3..c231126d58c0bc 100644 --- a/Lib/test/test_random.py +++ b/Lib/test/test_random.py @@ -1074,6 +1074,13 @@ def test_avg_std(self): self.assertAlmostEqual(s2/(N-1), sigmasqrd, places=2, msg='%s%r' % (variate.__name__, args)) + def test_binomialvariate_log_zero(self): + # gh-149222: Variety random() return 0.0 no input Error + with unittest.mock.patch.object(random.Random, 'random', side_effect=[0.0] + [0.5] * 20): + result = random.binomialvariate(10, 0.5) + self.assertIsInstance(result, int) + self.assertIn(result, range(11)) + def test_binomialvariate_btrs_random_zero(self): for p, expected in ((0.25, 25), (0.75, 75)): with self.subTest(p=p): _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]