diff options
author | Tim Peters <tim.peters@gmail.com> | 2004-06-20 02:50:16 +0000 |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2004-06-20 02:50:16 +0000 |
commit | 46bfc4121ac28c7a63d79b0aa21beee252717a78 (patch) | |
tree | 608c7316024b01d0ec2f424407c1b7dccbfcea38 /Lib/test/test_time.py | |
parent | e7eaa9e24de28f1800d0e0f5214ed8815024b2ea (diff) | |
download | cpython-46bfc4121ac28c7a63d79b0aa21beee252717a78.tar.gz |
Bug 975996: Add _PyTime_DoubleToTimet to C API
New include file timefuncs.h exports private API function
_PyTime_DoubleToTimet() from timemodule.c. timemodule should export
some other functions too (look for painful bits in datetimemodule.c).
Added insane-argument checking to datetime's assorted fromtimestamp()
and utcfromtimestamp() methods. Added insane-argument tests of these
to test_datetime, and insane-argument tests for ctime(), localtime()
and gmtime() to test_time.
Diffstat (limited to 'Lib/test/test_time.py')
-rw-r--r-- | Lib/test/test_time.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py index 9e16d0b122..64f1f01d6e 100644 --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -176,6 +176,14 @@ class TimeTestCase(unittest.TestCase): del environ['TZ'] time.tzset() + def test_insane_timestamps(self): + # It's possible that some platform maps time_t to double, + # and that this test will fail there. This test should + # exempt such platforms (provided they return reasonable + # results!). + for func in time.ctime, time.gmtime, time.localtime: + for unreasonable in -1e200, 1e200: + self.assertRaises(ValueError, func, unreasonable) def test_main(): test_support.run_unittest(TimeTestCase) |