From aad15414842ae797fa3f0d7a4a2868e9f8f71370 Mon Sep 17 00:00:00 2001 From: Ezio Melotti Date: Tue, 3 Aug 2010 06:49:14 +0000 Subject: [PATCH] Fix deprecation warnings in test_os.py --- Lib/test/test_os.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 3cb411beff8..e54ab4b7729 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -500,14 +500,16 @@ class DevNullTests (unittest.TestCase): 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