summaryrefslogtreecommitdiff
path: root/tests/test_dates.py
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2010-05-07 18:06:18 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2010-05-15 14:27:24 +0100
commitafea19651cd5bcdcfb58c858a41cb2512b2879da (patch)
treecfff3e2ad00d0a0ed4cda614a2631306359a7e1e /tests/test_dates.py
parentb04bf41f997f83c5834079e3cbf1702d73708780 (diff)
downloadpsycopg2-afea19651cd5bcdcfb58c858a41cb2512b2879da.tar.gz
Fixed TimestampFromTicks for second values > 59.5.
Bug reported and fixed by Jozsef Szalay on 2010-05-06 at 14:11:59.999920.
Diffstat (limited to 'tests/test_dates.py')
-rw-r--r--tests/test_dates.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_dates.py b/tests/test_dates.py
index 1ffb15a..e9977c8 100644
--- a/tests/test_dates.py
+++ b/tests/test_dates.py
@@ -478,6 +478,17 @@ if not hasattr(psycopg2._psycopg, 'MXDATETIME'):
del mxDateTimeTests
+class TimestampFromTicksTestCase(unittest.TestCase):
+ # bug "TimestampFromTicks() throws ValueError (2-2.0.14)"
+ # reported by Jozsef Szalay on 2010-05-06
+ def test_value_error_sec_59_99(self):
+ from datetime import datetime
+ s = psycopg2.TimestampFromTicks(1273173119.99992)
+ self.assertEqual(s.adapted,
+ datetime(2010, 5, 6, 14, 11, 59, 999920,
+ tzinfo=FixedOffsetTimezone(-5 * 60)))
+
+
def test_suite():
return unittest.TestLoader().loadTestsFromName(__name__)