mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 17:06:33 +03:00
Added regression test for infinity parsing in dates
...and a couple of typos.
This commit is contained in:
parent
1e94018473
commit
8fd228dd28
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue
Block a user