[Python-checkins] cpython: Issue #14180: TestDateTime.test_microsecond_rounding() handles localtime() and
victor.stinner
python-checkins at python.org
Wed Mar 14 00:20:38 CET 2012
http://hg.python.org/cpython/rev/706689b2d678
changeset: 75612:706689b2d678
user: Victor Stinner <victor.stinner at gmail.com>
date: Wed Mar 14 00:17:05 2012 +0100
summary:
Issue #14180: TestDateTime.test_microsecond_rounding() handles localtime() and
gmtime() failure on Windows
files:
Lib/test/datetimetester.py | 25 +++++++++++++++----------
1 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py
--- a/Lib/test/datetimetester.py
+++ b/Lib/test/datetimetester.py
@@ -1741,16 +1741,21 @@
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)
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list