[Python-checkins] r87920 - python/branches/py3k/Lib/test/test_time.py

alexander.belopolsky python-checkins at python.org
Tue Jan 11 02:35:22 CET 2011


Author: alexander.belopolsky
Date: Tue Jan 11 02:35:22 2011
New Revision: 87920
Log:
Make mktime test more robust.
Modified:
 python/branches/py3k/Lib/test/test_time.py
Modified: python/branches/py3k/Lib/test/test_time.py
==============================================================================
--- python/branches/py3k/Lib/test/test_time.py	(original)
+++ python/branches/py3k/Lib/test/test_time.py	Tue Jan 11 02:35:22 2011
@@ -348,9 +348,13 @@
 except (OverflowError, ValueError):
 pass
 self.assertEqual(time.mktime(tt), t)
- # Hopefully year = -1 is enough to make OS mktime fail
- self.assertRaises(OverflowError, time.mktime,
- (-1, 1, 1, 0, 0, 0, -1, -1, -1))
+ # It may not be possible to reliably make mktime return error
+ # on all platfom. This will make sure that no other exception
+ # than OverflowError is raised for an extreme value.
+ try:
+ time.mktime((-1, 1, 1, 0, 0, 0, -1, -1, -1))
+ except OverflowError:
+ pass
 
 class TestAsctimeAccept2dYear(_TestAsctimeYear, _Test2dYear):
 pass


More information about the Python-checkins mailing list

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