summaryrefslogtreecommitdiff
path: root/tests/test_dates.py
Commit message (Collapse)AuthorAgeFilesLines
* Fixed test in asian time zonesDaniele Varrazzo2018-01-101-1/+2
| | | | Fix #652
* Use relative imports throughout testsJon Dufresne2017-12-101-1/+1
| | | | | | | | | | | | | | The tests relied on Python2 relative import semantics. Python3 changed import semantics to always search sys.path by default. To import using a relative path it must have a leading dot. Forward compatible with newer Pythons. Works towards the goal of moving tests outside of the installed package. For more information, see PEP-328: https://www.python.org/dev/peps/pep-0328/
* Always import the system unittestJon Dufresne2017-12-011-1/+2
| | | | | | | There is no need to import testutils.unittest instead of simply unittest. They are simple aliases. Use system unittest to be more regular, consistent as well as idiomatic with the wider Python community.
* Added back timestamptz[] default castfix-578Daniele Varrazzo2017-07-241-0/+5
| | | | | | | | | | It was registered as side effect of an excessive definition that got cleaned up in 338dbe70a6c78c7edddea985e2386ebd864378c6. Looking at other removed redundant type oids, this was the only one missing from the `string_types` map. Close #578.
* Consider redshift interval supported after further testsDaniele Varrazzo2017-06-161-1/+3
|
* Parse a number as microseconds when casting intervalbug-558Daniele Varrazzo2017-06-161-0/+19
| | | | | | Should close #558, but I'm curious to know if a number is returned for interval < 1 day too (which wouldn't trigger the overflow, but will finish parsing with part=0).
* Return objects with timezone parsing infinity timestamptzDaniele Varrazzo2017-03-221-0/+19
| | | | Close #536.
* Skip test on PG version with bad interval roundingfix-512Daniele Varrazzo2017-03-011-0/+1
| | | | | | | | | On these ancient versions: =# select '999999:00:00.1'::interval; interval -------------------------------- 41666 days 15:00:00.0999999046
* Handle overflow in interval parsingDaniele Varrazzo2017-02-241-0/+18
|
* Parse interval only using integersDaniele Varrazzo2017-02-241-4/+21
| | | | | | | | | (almost... except for micros rounding) While this is probably an improvement on the previous implementation, I am largely waving a dead chicken at windows, which keeps failing to pass the seconds overflow test. If it doesn't pass now either I'll start blaming Python's timedelta.
* Try to fix the same problem in windowsDaniele Varrazzo2017-02-241-1/+20
| | | | | Previous commit doesn't pass on Windows: it looks like window's floor() has an integer overflow.
* Fixed integer overflow in interval typecasterDaniele Varrazzo2017-02-241-0/+4
| | | | Close #512.
* Python source cleanup using flake8Daniele Varrazzo2016-10-111-34/+45
|
* More tests tweaksDaniele Varrazzo2015-02-081-1/+1
| | | | | | Named cursors on old server versions have a different prefetch behaviour. This has hidden me the supported range of the 24:00 time format. Let's have another go at full testing...
* Don't test date 24:00 before PG 8.4Daniele Varrazzo2015-02-081-1/+2
|
* Convert Postgres time 24:00 into 00:00Daniele Varrazzo2015-02-081-0/+12
| | | | Fix ticket #278.
* Cast time into timetz when the tzinfo field is set.Hyunjun Kim2014-11-131-1/+11
|
* Added regression test for infinity parsing in datesDaniele Varrazzo2013-05-111-2/+10
| | | | ...and a couple of typos.
* Testing boilerplate unified in a single base classDaniele Varrazzo2013-04-071-9/+6
| | | | | The class makes a connection always available, allows creating new connection and closes everything on tear down.
* Fixed pickling of FixedOffsetTimezone objectsDaniele Varrazzo2012-10-211-0/+18
| | | | | | | I have also verified that the fixed class can unpickle instance pickled with the buggy one and viceversa. Fixes ticket #135.
* Cache FixedOffsetTimezone instancesMenno Smits2012-01-301-0/+7
| | | | | | | Avoid creating new a new FixedOffsetTimezone instance if one with the same offset and name has been created before. This will save memory when returning many rows containing "timestamp with timezone" columns, and also improves comparability.
* Fixed repr for FixedOffsetTimezone for offsets west of UTC (negative)Menno Smits2012-01-301-1/+20
| | | | | | | | The offset displayed was always positive and somewhat confusing. The offset displayed now is the offset that the instance was created with. Also added some tests for initialisation.
* Renamed shadowed test methodMenno Smits2012-01-291-1/+1
|
* Work around mxDateTime 3.2.0 segfault in testsDaniele Varrazzo2011-11-011-6/+6
|
* Test suite fixed to make it compatible with the ctypes implementationDaniele Varrazzo2011-10-191-6/+9
|
* Test tweaked to deal with missing usecs in BC timestampsDaniele Varrazzo2011-06-031-1/+5
| | | | | Probably depending on compile time options. On my test db usecs are available from PG 8.4.
* Merge branch 'python2' into python3Daniele Varrazzo2011-01-101-0/+22
|\ | | | | | | | | | | | | | | | | Conflicts: NEWS-2.3 tests/__init__.py tests/test_lobject.py tests/test_quote.py tests/testutils.py
| * Added license to unit testsDaniele Varrazzo2011-01-091-0/+22
| | | | | | | | As the test suite is now part of the source distribution.
| * All tests made executable.Daniele Varrazzo2011-01-071-0/+0
| |
* | Test suite converted into a proper package.Daniele Varrazzo2010-12-211-3/+3
| | | | | | | | | | | | Dropped cyclic import from modules to tests: they were only working because a second copy of the package was found in the project dir. Use relative import so that 2to3 can do a good conversion.
* | Some light cleanup for Py3 conversion.Daniele Varrazzo2010-12-211-9/+9
|/ | | | Either flagged as warning by python2.6 -3 or converted by 2to3.
* Handle time zones with seconds in the UTC offset.Daniele Varrazzo2010-05-201-36/+20
| | | | The offset is rounded to the nearest minute.
* Fixed time test to be independent from the TZ it runs.Daniele Varrazzo2010-05-151-2/+2
|
* Fixed TimeFromTicks for second values > 59.5.Daniele Varrazzo2010-05-151-2/+13
|
* Fixed TimestampFromTicks for second values > 59.5.Daniele Varrazzo2010-05-151-0/+11
| | | | Bug reported and fixed by Jozsef Szalay on 2010-05-06 at 14:11:59.999920.
* Cast datetime into timestamptz when the tzinfo field is set.Daniele Varrazzo2010-05-151-1/+12
|
* Explicit cast of the SQL representation of time-related objects.Daniele Varrazzo2010-05-151-0/+91
| | | | | | | | Allow the objects to be recognized as the proper type by Postgres in not strong contexts: problem reported by Peter Eisentraut. Added tests to check the types are respected in a complete Py -> PG -> Py roundtrip without context.
* Changes license to LGPL3 + OpenSSL exception on all source filesFederico Di Gregorio2010-02-121-3/+4
|
* Fixed test_dates failures in older version of PythonFederico Di Gregorio2009-04-011-4/+4
|
* * tests/test_dates.py (DatetimeTests, mxDateTimeTests): full testJames Henstridge2009-02-171-59/+145
| | | | | | | | | | | | | | | | | | coverage for datetime and time strings with and without time zone information. * psycopg/typecast_datetime.c (typecast_PYDATETIME_cast): adjust to handle the changes in typecast_parse_time. (typecast_PYTIME_cast): add support for time zone aware time values. * psycopg/typecast_mxdatetime.c (typecast_MXDATE_cast): make sure that values with time zones are correctly processed (even though that means ignoring the time zone value). (typecast_MXTIME_cast): same here. * psycopg/typecast.c (typecast_parse_time): Update method to parse second resolution timezone offsets.
* * psycopg/typecast.c (typecast_parse_time): Fix up handling ofJames Henstridge2009-02-171-1/+4
| | | | | | | | negative timezone offsets with a non-zero minutes field. * tests/test_dates.py (DatetimeTests): Add tests for time zone parsing. The test for HH:MM:SS time zones is disabled because we don't currently support it.
* Add tests for time zone parsing, for "HH", "HH:MM" and "HH:MM:SS" forms. James Henstridge2009-02-171-0/+39
| | | | | | Currently the second fails for negative offsets due to bugs in the parser, and the third fails because it doesn't even try to parse second offset values (as Python doesn't either).
* 2008-04-21 Jorgen Austvik <Jorgen.Austvik@sun.com>James Henstridge2008-04-201-1/+1
| | | | | | | * tests/*.py: use the DSN constructed in tests/__init__.py. * tests/__init__.py: allow setting the host, port and user for the DSN used by the tests through the environment.
* * psycopg/typecast.c (typecast_parse_time): give the correctJames Henstridge2008-03-171-233/+19
| | | | | | | | | | | | | | | | | | | | | | return value for partially parsed time values. * psycopg/typecast_mxdatetime.c (typecast_MXDATE_cast): return NULL after setting DataError. Also, don't treat it as an error if typecast_parse_time() returns 0 (as might happen if the remainder of the string is " BC"). * psycopg/typecast_datetime.c (typecast_PYDATE_cast): return NULL after setting DataError. (typecast_PYDATETIME_cast): same here. (typecast_PYTIME_cast): same here. * tests/test_dates.py (CommonDatetimeTestsMixin.test_parse_incomplete_date): test that parsing incomplete date values results in DataError. (CommonDatetimeTestsMixin.test_parse_incomplete_time): same for times. (CommonDatetimeTestsMixin.test_parse_incomplete_time): same for datetimes.
* * tests/__init__.py (test_suite): add date tests to test suite.James Henstridge2008-01-161-0/+468
* tests/test_dates.py: add tests for date/time typecasting and adaption. * psycopg/adapter_mxdatetime.c (mxdatetime_str): add support for outputting BC dates (which involves switching them to one-based dates). Also remove broken handling of microseconds. * psycopg/typecast.c (typecast_parse_date): if the string ends with "BC" adjust the year value to be a zero-based BC value as used by mx.DateTime (datetime doesn't support BC dates). (typecast_parse_time): ignore ' ', 'B' and 'C' in time strings rather than treating them as part of the seconds part of the time.