mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
Issue #5080: turn the DeprecationWarning from float arguments passed
to integer PyArg_Parse* format codes into a TypeError. Add a DeprecationWarning for floats passed with the 'L' format code, which didn't previously have a warning.
This commit is contained in:
parent
edfe72f66f
commit
1b34d2552c
6 changed files with 65 additions and 28 deletions
|
@ -502,11 +502,9 @@ class URandomTests (unittest.TestCase):
|
|||
self.assertEqual(len(os.urandom(100)), 100)
|
||||
self.assertEqual(len(os.urandom(1000)), 1000)
|
||||
# see http://bugs.python.org/issue3708
|
||||
with test_support.check_warnings():
|
||||
# silence deprecation warnings about float arguments
|
||||
self.assertEqual(len(os.urandom(0.9)), 0)
|
||||
self.assertEqual(len(os.urandom(1.1)), 1)
|
||||
self.assertEqual(len(os.urandom(2.0)), 2)
|
||||
self.assertRaises(TypeError, os.urandom, 0.9)
|
||||
self.assertRaises(TypeError, os.urandom, 1.1)
|
||||
self.assertRaises(TypeError, os.urandom, 2.0)
|
||||
except NotImplementedError:
|
||||
pass
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue