[Python-checkins] r68785 - python/trunk/Lib/test/test_os.py

Benjamin Peterson benjamin at python.org
Tue Jan 20 15:13:27 CET 2009


On Tue, Jan 20, 2009 at 4:00 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> benjamin.peterson wrote:
>> + 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)
>> except NotImplementedError:
>> pass
>>> If you're going to add the check_warnings call, you might as well add
> the corresponding asserts to check that the DeprecationWarnings are
> actually being emitted...

The deprecation warnings aren't the point of the test; it's to make
sure os.urandom doesn't go into an infinite loop when its passed float
arguments. I assume the actual deprecation of coercing floats to ints
is tested elsewhere.
-- 
Regards,
Benjamin


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /