Kaydet (Commit) 31c5dd6b authored tarafından Alexander Belopolsky's avatar Alexander Belopolsky

Make mktime test more robust.

üst b7d40d17
...@@ -348,9 +348,13 @@ class _Test4dYear(_BaseYearTest): ...@@ -348,9 +348,13 @@ class _Test4dYear(_BaseYearTest):
except (OverflowError, ValueError): except (OverflowError, ValueError):
pass pass
self.assertEqual(time.mktime(tt), t) self.assertEqual(time.mktime(tt), t)
# Hopefully year = -1 is enough to make OS mktime fail # It may not be possible to reliably make mktime return error
self.assertRaises(OverflowError, time.mktime, # on all platfom. This will make sure that no other exception
(-1, 1, 1, 0, 0, 0, -1, -1, -1)) # 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): class TestAsctimeAccept2dYear(_TestAsctimeYear, _Test2dYear):
pass pass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment