[Python-checkins] r75419 - python/trunk/Lib/test/test_random.py

antoine.pitrou python-checkins at python.org
Wed Oct 14 20:56:12 CEST 2009


Author: antoine.pitrou
Date: Wed Oct 14 20:56:11 2009
New Revision: 75419

Log:
Silence py3k warning claiming to affect the random module



Modified:
   python/trunk/Lib/test/test_random.py

Modified: python/trunk/Lib/test/test_random.py
==============================================================================
--- python/trunk/Lib/test/test_random.py	(original)
+++ python/trunk/Lib/test/test_random.py	Wed Oct 14 20:56:11 2009
@@ -52,10 +52,12 @@
         state3 = self.gen.getstate()    # s/b distinct from state2
         self.assertNotEqual(state2, state3)
 
-        self.assertRaises(TypeError, self.gen.jumpahead)  # needs an arg
-        self.assertRaises(TypeError, self.gen.jumpahead, "ick")  # wrong type
-        self.assertRaises(TypeError, self.gen.jumpahead, 2.3)  # wrong type
-        self.assertRaises(TypeError, self.gen.jumpahead, 2, 3)  # too many
+        # Silence py3k warnings
+        with test_support.check_warnings():
+            self.assertRaises(TypeError, self.gen.jumpahead)  # needs an arg
+            self.assertRaises(TypeError, self.gen.jumpahead, "ick")  # wrong type
+            self.assertRaises(TypeError, self.gen.jumpahead, 2.3)  # wrong type
+            self.assertRaises(TypeError, self.gen.jumpahead, 2, 3)  # too many
 
     def test_sample(self):
         # For the entire allowable range of 0 <= k <= N, validate that


More information about the Python-checkins mailing list