Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a6edea5

Browse files
committed
Issue #19588: Fixed tests in test_random that were silently skipped most
of the time. Patch by Julian Gindi.
1 parent a04f4e0 commit a6edea5

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

Lib/test/test_random.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,10 @@ def test_bigrand(self):
194194

195195
def test_bigrand_ranges(self):
196196
for i in [40,80, 160, 200, 211, 250, 375, 512, 550]:
197-
start = self.gen.randrange(2 ** i)
198-
stop = self.gen.randrange(2 ** (i-2))
197+
start = self.gen.randrange(2 ** (i-2))
198+
stop = self.gen.randrange(2 ** i)
199199
if stop <= start:
200-
return
200+
continue
201201
self.assertTrue(start <= self.gen.randrange(start, stop) < stop)
202202

203203
def test_rangelimits(self):
@@ -357,10 +357,10 @@ def test_bigrand(self):
357357

358358
def test_bigrand_ranges(self):
359359
for i in [40,80, 160, 200, 211, 250, 375, 512, 550]:
360-
start = self.gen.randrange(2 ** i)
361-
stop = self.gen.randrange(2 ** (i-2))
360+
start = self.gen.randrange(2 ** (i-2))
361+
stop = self.gen.randrange(2 ** i)
362362
if stop <= start:
363-
return
363+
continue
364364
self.assertTrue(start <= self.gen.randrange(start, stop) < stop)
365365

366366
def test_rangelimits(self):

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ Dinu Gherman
435435
Jonathan Giddy
436436
Johannes Gijsbers
437437
Michael Gilfix
438+
Julian Gindi
438439
Yannick Gingras
439440
Matt Giuca
440441
Wim Glenn

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ Library
6565
Tests
6666
-----
6767

68+
- Issue #19588: Fixed tests in test_random that were silently skipped most
69+
of the time. Patch by Julian Gindi.
70+
6871
- Issue #19596: Set untestable tests in test_importlib to None to avoid
6972
reporting success on empty tests.
7073

0 commit comments

Comments
 (0)