mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 08:56:34 +03:00
parent
2332f2c99e
commit
d3c1ad5945
1
NEWS
1
NEWS
|
@ -21,6 +21,7 @@ What's new in psycopg 2.5.5
|
|||
|
||||
- Named cursors used as context manager don't swallow the exception on exit
|
||||
(:ticket:`#262`).
|
||||
- PostgreSQL time 24:00 is converted to Python 00:00 (:ticket:`#278`).
|
||||
|
||||
|
||||
What's new in psycopg 2.5.4
|
||||
|
|
|
@ -164,6 +164,9 @@ typecast_parse_time(const char* s, const char** t, Py_ssize_t* len,
|
|||
while (usd++ < 6) *us *= 10;
|
||||
}
|
||||
|
||||
/* 24:00:00 -> 00:00:00 (ticket #278) */
|
||||
if (*hh == 24) { *hh = 0; }
|
||||
|
||||
return cz;
|
||||
}
|
||||
|
||||
|
|
|
@ -319,6 +319,18 @@ class DatetimeTests(ConnectingTestCase, CommonDatetimeTestsMixin):
|
|||
from datetime import timedelta
|
||||
self._test_type_roundtrip_array(timedelta(seconds=30))
|
||||
|
||||
def test_time_24(self):
|
||||
from datetime import time
|
||||
|
||||
t = self.execute("select '24:00'::time;")
|
||||
self.assertEqual(t, time(0, 0))
|
||||
|
||||
t = self.execute("select '24:00+05'::timetz;")
|
||||
self.assertEqual(t, time(0, 0, tzinfo=FixedOffsetTimezone(300)))
|
||||
|
||||
t = self.execute("select '24:00+05:30'::timetz;")
|
||||
self.assertEqual(t, time(0, 0, tzinfo=FixedOffsetTimezone(330)))
|
||||
|
||||
|
||||
# Only run the datetime tests if psycopg was compiled with support.
|
||||
if not hasattr(psycopg2.extensions, 'PYDATETIME'):
|
||||
|
|
Loading…
Reference in New Issue
Block a user