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

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

index 33164150c3650b8f2aea7d99c0e11475aa6ffdaa..911bdec552b95656e0947ae63d97014b872733f2 100644 (file)
@@ -251,10 +251,10 @@ class SystemRandom_TestBasicOps(TestBasicOps):
 
     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):
@@ -403,10 +403,10 @@ class MersenneTwister_TestBasicOps(TestBasicOps):
 
     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 e276960db78e75b7610c8a082b581780433b08f0..5e0342a64a5325918dcfe844b2326d446685107f 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -362,6 +362,7 @@ Dinu Gherman
 Jonathan Giddy
 Johannes Gijsbers
 Michael Gilfix
+Julian Gindi
 Wim Glenn
 Christoph Gohlke
 Tim Golden
index 6815aa22e86b9c926176b5859763bece3f1edeef..3d054c00f492f9628af1b00888f1d385737f32c8 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -50,6 +50,9 @@ Library
 Tests
 -----
 
+- Issue #19588: Fixed tests in test_random that were silently skipped most
+  of the time.  Patch by Julian Gindi.
+
 - Issue #17883: Tweak test_tcl testLoadWithUNC to skip the test in the
   event of a permission error on Windows and to properly report other
   skip conditions.