diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2012-03-13 23:17:05 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2012-03-13 23:17:05 (GMT) |
commit | 8050ca9c6f614d2beb47cc1b53d73f3721f57c8f (patch) | |
tree | 1057897ac4ed03c7075b65025f9b000d3ede4c52 /Lib/test/datetimetester.py | |
parent | 21f5893571e953aa6042ef686bc2ea539acf39d1 (diff) | |
download | cpython-8050ca9c6f614d2beb47cc1b53d73f3721f57c8f.zip cpython-8050ca9c6f614d2beb47cc1b53d73f3721f57c8f.tar.gz cpython-8050ca9c6f614d2beb47cc1b53d73f3721f57c8f.tar.bz2 |
Issue #14180: TestDateTime.test_microsecond_rounding() handles localtime() and
gmtime() failure on Windows
Diffstat (limited to 'Lib/test/datetimetester.py')
-rw-r--r-- | Lib/test/datetimetester.py | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py index 6de29c5..853806b 100644 --- a/Lib/test/datetimetester.py +++ b/Lib/test/datetimetester.py @@ -1741,16 +1741,21 @@ class TestDateTime(TestDate): zero = fts(0) self.assertEqual(zero.second, 0) self.assertEqual(zero.microsecond, 0) - minus_one = fts(-1e-6) - self.assertEqual(minus_one.second, 59) - self.assertEqual(minus_one.microsecond, 999999) - - t = fts(-1e-8) - self.assertEqual(t, minus_one) - t = fts(-9e-7) - self.assertEqual(t, minus_one) - t = fts(-1e-7) - self.assertEqual(t, minus_one) + try: + minus_one = fts(-1e-6) + except OSError: + # localtime(-1) and gmtime(-1) is not supported on Windows + pass + else: + self.assertEqual(minus_one.second, 59) + self.assertEqual(minus_one.microsecond, 999999) + + t = fts(-1e-8) + self.assertEqual(t, minus_one) + t = fts(-9e-7) + self.assertEqual(t, minus_one) + t = fts(-1e-7) + self.assertEqual(t, minus_one) t = fts(1e-7) self.assertEqual(t, zero) |