Commit a6edea53 authored by Zachary Ware's avatar Zachary Ware

Issue #19588: Fixed tests in test_random that were silently skipped most

of the time.  Patch by Julian Gindi.
parent a04f4e03
...@@ -194,10 +194,10 @@ class SystemRandom_TestBasicOps(TestBasicOps, unittest.TestCase): ...@@ -194,10 +194,10 @@ class SystemRandom_TestBasicOps(TestBasicOps, unittest.TestCase):
def test_bigrand_ranges(self): def test_bigrand_ranges(self):
for i in [40,80, 160, 200, 211, 250, 375, 512, 550]: for i in [40,80, 160, 200, 211, 250, 375, 512, 550]:
start = self.gen.randrange(2 ** i) start = self.gen.randrange(2 ** (i-2))
stop = self.gen.randrange(2 ** (i-2)) stop = self.gen.randrange(2 ** i)
if stop <= start: if stop <= start:
return continue
self.assertTrue(start <= self.gen.randrange(start, stop) < stop) self.assertTrue(start <= self.gen.randrange(start, stop) < stop)
def test_rangelimits(self): def test_rangelimits(self):
...@@ -357,10 +357,10 @@ class MersenneTwister_TestBasicOps(TestBasicOps, unittest.TestCase): ...@@ -357,10 +357,10 @@ class MersenneTwister_TestBasicOps(TestBasicOps, unittest.TestCase):
def test_bigrand_ranges(self): def test_bigrand_ranges(self):
for i in [40,80, 160, 200, 211, 250, 375, 512, 550]: for i in [40,80, 160, 200, 211, 250, 375, 512, 550]:
start = self.gen.randrange(2 ** i) start = self.gen.randrange(2 ** (i-2))
stop = self.gen.randrange(2 ** (i-2)) stop = self.gen.randrange(2 ** i)
if stop <= start: if stop <= start:
return continue
self.assertTrue(start <= self.gen.randrange(start, stop) < stop) self.assertTrue(start <= self.gen.randrange(start, stop) < stop)
def test_rangelimits(self): def test_rangelimits(self):
......
...@@ -435,6 +435,7 @@ Dinu Gherman ...@@ -435,6 +435,7 @@ Dinu Gherman
Jonathan Giddy Jonathan Giddy
Johannes Gijsbers Johannes Gijsbers
Michael Gilfix Michael Gilfix
Julian Gindi
Yannick Gingras Yannick Gingras
Matt Giuca Matt Giuca
Wim Glenn Wim Glenn
......
...@@ -65,6 +65,9 @@ Library ...@@ -65,6 +65,9 @@ Library
Tests Tests
----- -----
- Issue #19588: Fixed tests in test_random that were silently skipped most
of the time. Patch by Julian Gindi.
- Issue #19596: Set untestable tests in test_importlib to None to avoid - Issue #19596: Set untestable tests in test_importlib to None to avoid
reporting success on empty tests. reporting success on empty tests.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment