[Jython-checkins] jython: Fixed test_datetime_jy.

stefan.richthofer jython-checkins at python.org
Sun Mar 12 20:26:42 EDT 2017


https://hg.python.org/jython/rev/3adbec1576f5
changeset:   8054:3adbec1576f5
user:        Stefan Richthofer <stefan.richthofer at gmx.de>
date:        Mon Mar 13 01:26:07 2017 +0100
summary:
  Fixed test_datetime_jy.

files:
  Lib/test/test_datetime_jy.py |  5 ++++-
  1 files changed, 4 insertions(+), 1 deletions(-)


diff --git a/Lib/test/test_datetime_jy.py b/Lib/test/test_datetime_jy.py
--- a/Lib/test/test_datetime_jy.py
+++ b/Lib/test/test_datetime_jy.py
@@ -111,7 +111,10 @@
         self.assertIsInstance(y, Date)
         # Note that java.sql.Date operates regarding to default timezone, so adjust offset
         off = TimeZone.getDefault().getRawOffset()
-        self.assertEqual(y.getTime()+off, (x - date(1970, 1, 1)).total_seconds() * 1000)
+        # It's sufficient for the date to fit; we modulo away the time, so this test
+        # won't run into TimeZone issues.
+        self.assertEqual((y.getTime()+off)//(1000*60*60*24),
+                (x - date(1970, 1, 1)).total_seconds()//(60*60*24))
 
     def test_time(self):
         self.assertTrue(hasattr(time, "__tojava__"))

-- 
Repository URL: https://hg.python.org/jython


More information about the Jython-checkins mailing list