summaryrefslogtreecommitdiffstats
path: root/Lib/test/datetimetester.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2012-03-13 23:17:05 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2012-03-13 23:17:05 (GMT)
commit8050ca9c6f614d2beb47cc1b53d73f3721f57c8f (patch)
tree1057897ac4ed03c7075b65025f9b000d3ede4c52 /Lib/test/datetimetester.py
parent21f5893571e953aa6042ef686bc2ea539acf39d1 (diff)
downloadcpython-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.py25
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)