[Python-checkins] r83638 - python/branches/release26-maint/Lib/test/test_os.py

ezio.melotti python-checkins at python.org
Tue Aug 3 08:49:14 CEST 2010


Author: ezio.melotti
Date: Tue Aug  3 08:49:14 2010
New Revision: 83638

Log:
Fix deprecation warnings in test_os.py

Modified:
   python/branches/release26-maint/Lib/test/test_os.py

Modified: python/branches/release26-maint/Lib/test/test_os.py
==============================================================================
--- python/branches/release26-maint/Lib/test/test_os.py	(original)
+++ python/branches/release26-maint/Lib/test/test_os.py	Tue Aug  3 08:49:14 2010
@@ -500,14 +500,16 @@
 class URandomTests (unittest.TestCase):
     def test_urandom(self):
         try:
-            self.assertEqual(len(os.urandom(1)), 1)
-            self.assertEqual(len(os.urandom(10)), 10)
-            self.assertEqual(len(os.urandom(100)), 100)
-            self.assertEqual(len(os.urandom(1000)), 1000)
-            # see http://bugs.python.org/issue3708
-            self.assertEqual(len(os.urandom(0.9)), 0)
-            self.assertEqual(len(os.urandom(1.1)), 1)
-            self.assertEqual(len(os.urandom(2.0)), 2)
+            with test_support._check_py3k_warnings(
+                ('integer argument expected, got float', DeprecationWarning)):
+                self.assertEqual(len(os.urandom(1)), 1)
+                self.assertEqual(len(os.urandom(10)), 10)
+                self.assertEqual(len(os.urandom(100)), 100)
+                self.assertEqual(len(os.urandom(1000)), 1000)
+                # see http://bugs.python.org/issue3708
+                self.assertEqual(len(os.urandom(0.9)), 0)
+                self.assertEqual(len(os.urandom(1.1)), 1)
+                self.assertEqual(len(os.urandom(2.0)), 2)
         except NotImplementedError:
             pass
 


More information about the Python-checkins mailing list