Skip to content

Commit faf4a70

Browse files
committed
Add missing test
1 parent 5c5210e commit faf4a70

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Lib/test/test_random.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,6 +1101,13 @@ def test_avg_std(self):
11011101
self.assertAlmostEqual(s2/(N-1), sigmasqrd, places=2,
11021102
msg='%s%r' % (variate.__name__, args))
11031103

1104+
def test_binomialvariate_log_zero(self):
1105+
# gh-149222: Variety random() return 0.0 no input Error
1106+
with unittest.mock.patch.object(random.Random, 'random', side_effect= [0.0] + [0.5] * 20):
1107+
result = random.binomialvariate(10, 0.5)
1108+
self.assertIsInstance(result, int)
1109+
self.assertIn(result, range(11))
1110+
11041111
def test_constant(self):
11051112
g = random.Random()
11061113
N = 100

0 commit comments

Comments
 (0)