mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 00:46:33 +03:00
parent
e39bf0fd6e
commit
7c5bc1b6cf
1
NEWS
1
NEWS
|
@ -6,6 +6,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;
|
||||
}
|
||||
|
||||
|
|
|
@ -309,6 +309,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