]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #19588: Fixed tests in test_random that were silently skipped most
authorZachary Ware <zachary.ware@gmail.com>
Tue, 26 Nov 2013 20:50:10 +0000 (14:50 -0600)
committerZachary Ware <zachary.ware@gmail.com>
Tue, 26 Nov 2013 20:50:10 +0000 (14:50 -0600)
of the time.  Patch by Julian Gindi.

Lib/test/test_random.py
Misc/ACKS
Misc/NEWS

index facddb1ebd899e9ccc0901ad989cfb96d8b8daf5..d363a6a1d15adf4826be0eb15282f41d3dd7ac62 100644 (file)
@@ -194,10 +194,10 @@ class SystemRandom_TestBasicOps(TestBasicOps, unittest.TestCase):
 
     def test_bigrand_ranges(self):
         for i in [40,80, 160, 200, 211, 250, 375, 512, 550]:
-            start = self.gen.randrange(2 ** i)
-            stop = self.gen.randrange(2 ** (i-2))
+            start = self.gen.randrange(2 ** (i-2))
+            stop = self.gen.randrange(2 ** i)
             if stop <= start:
-                return
+                continue
             self.assertTrue(start <= self.gen.randrange(start, stop) < stop)
 
     def test_rangelimits(self):
@@ -357,10 +357,10 @@ class MersenneTwister_TestBasicOps(TestBasicOps, unittest.TestCase):
 
     def test_bigrand_ranges(self):
         for i in [40,80, 160, 200, 211, 250, 375, 512, 550]:
-            start = self.gen.randrange(2 ** i)
-            stop = self.gen.randrange(2 ** (i-2))
+            start = self.gen.randrange(2 ** (i-2))
+            stop = self.gen.randrange(2 ** i)
             if stop <= start:
-                return
+                continue
             self.assertTrue(start <= self.gen.randrange(start, stop) < stop)
 
     def test_rangelimits(self):
index 5b0f8b045b98eaa31777ef3858a2c6f7add37988..39b0f704d1309f8cc8cc374051886540439d1367 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -435,6 +435,7 @@ Dinu Gherman
 Jonathan Giddy
 Johannes Gijsbers
 Michael Gilfix
+Julian Gindi
 Yannick Gingras
 Matt Giuca
 Wim Glenn
index 84217e7b2188c5446f901012f82fc93bb6c31333..f488230dad94c1fdb508950ae0c69c8a95fbaafe 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -65,6 +65,9 @@ Library
 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
   reporting success on empty tests.