From 8fd228dd28ab2ac3b5665d980234d59f75ba9856 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Fri, 10 May 2013 23:25:06 +0100 Subject: [PATCH] Added regression test for infinity parsing in dates ...and a couple of typos. --- tests/test_dates.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/test_dates.py b/tests/test_dates.py index cc183c57..24c4a9ad 100755 --- a/tests/test_dates.py +++ b/tests/test_dates.py @@ -213,6 +213,14 @@ class DatetimeTests(ConnectingTestCase, CommonDatetimeTestsMixin): self.assertEqual(value.seconds, 41103) self.assertEqual(value.microseconds, 876544) + def test_parse_infinity(self): + value = self.DATETIME('-infinity', self.curs) + self.assertEqual(str(value), '0001-01-01 00:00:00') + value = self.DATETIME('infinity', self.curs) + self.assertEqual(str(value), '9999-12-31 23:59:59.999999') + value = self.DATE('infinity', self.curs) + self.assertEqual(str(value), '9999-12-31') + def test_adapt_date(self): from datetime import date value = self.execute('select (%s)::date::text', @@ -240,7 +248,7 @@ class DatetimeTests(ConnectingTestCase, CommonDatetimeTestsMixin): self.assertEqual(seconds, 3674096) self.assertEqual(int(round((value - seconds) * 1000000)), 123456) - def test_adapt_megative_timedelta(self): + def test_adapt_negative_timedelta(self): from datetime import timedelta value = self.execute('select extract(epoch from (%s)::interval)', [timedelta(days=-42, seconds=45296, @@ -428,7 +436,7 @@ class mxDateTimeTests(ConnectingTestCase, CommonDatetimeTestsMixin): self.assertEqual(seconds, 3674096) self.assertEqual(int(round((value - seconds) * 1000000)), 123456) - def test_adapt_megative_timedelta(self): + def test_adapt_negative_timedelta(self): from mx.DateTime import DateTimeDeltaFrom value = self.execute('select extract(epoch from (%s)::interval)', [DateTimeDeltaFrom(days=-42,