Commit Graph

152 Commits

Author SHA1 Message Date
Oren Milman 865e4b4f63 bpo-31293: Fix crashes in truediv and mul of a timedelta by a float with a bad as_integer_ratio() method. (#3227) 2017-09-19 15:58:11 +03:00
Alexander Belopolsky 018d353c1c Closes issue bpo-5288: Allow tzinfo objects with sub-minute offsets. (#2896)
* Closes issue bpo-5288: Allow tzinfo objects with sub-minute offsets.

* bpo-5288: Implemented %z formatting of sub-minute offsets.

* bpo-5288: Removed mentions of the whole minute limitation on TZ offsets.

* bpo-5288: Removed one more mention of the whole minute limitation.

Thanks @csabella!

* Fix a formatting error in the docs

* Addressed review comments.

Thanks, @haypo.
2017-07-31 10:26:50 -04:00
Utkarsh Upadhyay cc5a65cd90 bpo-30302 Make timedelta.__repr__ more informative. (#1493) 2017-07-25 23:51:33 +02:00
Utkarsh Upadhyay 287c5594ed bpo-30822: Fix testing of datetime module. (#2530) (#2783)
Only C implementation was tested.
2017-07-21 02:14:54 +02:00
Victor Stinner 8207c17486 Revert "bpo-30822: Fix testing of datetime module." (#2588)
* Revert "bpo-30854: Fix compile error when --without-threads (#2581)"

This reverts commit 0c31163093.

* Revert "NEWS for 30777 (#2576)"

This reverts commit aaa917ff38.

* Revert "bpo-21624: IDLE -- minor htest fixes (#2575)"

This reverts commit 2000150c56.

* Revert "bpo-30777: IDLE: configdialog - add docstrings and improve comments (#2440)"

This reverts commit 7eb5883ac5.

* Revert "bpo-30319: socket.close() now ignores ECONNRESET (#2565)"

This reverts commit 67e1478dba.

* Revert "bpo-30789: Use a single memory block for co_extra. (#2555)"

This reverts commit 378ebb6578.

* Revert "bpo-30845: Enhance test_concurrent_futures cleanup (#2564)"

This reverts commit 3df9dec425.

* Revert "bpo-29293: multiprocessing.Condition.notify() lacks parameter `n` (#2480)"

This reverts commit 48350412b7.

* Revert "Remove outdated FOX from GUI FAQ (GH-2538)"

This reverts commit d3ed2877a7.

* Revert "bpo-6691: Pyclbr now reports nested classes and functions. (#2503)"

This reverts commit 246ff3bd00.

* Revert "bpo-29464: Rename METH_FASTCALL to METH_FASTCALL|METH_KEYWORDS and make (#1955)"

This reverts commit 6969eaf468.

* Revert "bpo-30832: Remove own implementation for thread-local storage (#2537)"

This reverts commit aa0aa0492c.

* Revert "bpo-30764: Fix regrtest --fail-env-changed --forever (#2536)"

This reverts commit 5e87592fd1.

* Revert "bpo-30822: Deduplicate ZoneInfoTest classes in test_datetime. (#2534)"

This reverts commit 34b54873b5.

* Revert "bpo-30822: Fix testing of datetime module. (#2530)"

This reverts commit 98b6bc3bf7.
2017-07-05 15:44:52 +02:00
Utkarsh Upadhyay 98b6bc3bf7 bpo-30822: Fix testing of datetime module. (#2530)
Only C implementation was tested.
2017-07-02 15:46:04 +03:00
Serhiy Storchaka 314d6fca36 bpo-29953: Fix memory leaks in the replace() method of datetime and time (#927)
objects when pass out of bound fold argument.
2017-03-31 22:48:16 +03:00
Victor Stinner 2a35c939cc Fix test_datetime on Windows
Issue #29100: On Windows, datetime.datetime.fromtimestamp(min_ts) fails with an
OSError in test_timestamp_limits().
2017-02-10 12:37:21 +01:00
Victor Stinner 6f37e3645d Fix test_datetime on system with 32-bit time_t
Issue #29100: Catch OverflowError in the new test_timestamp_limits() test.
2017-02-10 11:45:14 +01:00
Victor Stinner b67f096738 Fix datetime.fromtimestamp(): check bounds
Issue #29100: Fix datetime.fromtimestamp() regression introduced in Python
3.6.0: check minimum and maximum years.
2017-02-10 10:34:02 +01:00
Serhiy Storchaka 546ce65968 Issue #28752: Restored the __reduce__() methods of datetime objects. 2016-11-22 00:29:42 +02:00
R David Murray 44b548dda8 #27364: fix "incorrect" uses of escape character in the stdlib.
And most of the tools.

Patch by Emanual Barry, reviewed by me, Serhiy Storchaka, and
Martin Panter.
2016-09-08 13:59:53 -04:00
Raymond Hettinger 15f44ab043 Issue #27895: Spelling fixes (Contributed by Ville Skyttä). 2016-08-30 10:47:49 -07:00
Alexander Belopolsky 7c7c14696b Issue #27834: Avoid overflow error in ZoneInfo.invert(). 2016-08-23 14:44:51 -04:00
Alexander Belopolsky e09594d5eb Issue #24773: Include Tallinn 1999-10-31 transition in tests.
Does not appear to be a problem anymore and I cannot figure
out why it was skipped in the first place.
2016-08-17 19:56:17 -04:00
Alexander Belopolsky 10c2dd216a Issue #24773: Skip system tests for transitions in year 2037 and later. 2016-08-12 19:08:15 -04:00
Alexander Belopolsky 1b8f26c2ed Issue #24773: Fix and speed-up ZoneInfoCompleteTest.
* Read the zone.tab file for the list of zones to exclude
  the aliases.
  * Skip Casablanca and El_Aaiun October 2037 transitions.
2016-08-11 11:01:45 -04:00
Alexander Belopolsky 47649ab1f1 Closes #27710: Disallow fold not in [0, 1] in time and datetime constructors. 2016-08-08 17:05:40 -04:00
Alexander Belopolsky 43746c3770 Closes #27661: Added tzinfo keyword argument to datetime.combine. 2016-08-02 17:49:30 -04:00
Alexander Belopolsky 07e2a0aba9 Issue 24773: Use the standard Asia/Tehran name in the Iran test. 2016-07-30 11:41:02 -04:00
Alexander Belopolsky 611adf2466 Issue #24773: Fixed tests failures on systems with 32-bit time_t.
Several 32-bit systems have issues with transitions in the year
2037. This is a bug in the system C library since time_t does not
overflow until 2038, but let's skip tests starting from 2037 to work
around those bugs.
2016-07-26 12:23:16 -04:00
Alexander Belopolsky 95f7b9fcac Issue 24773: Make zoneinfo tests more robust. (reapply) 2016-07-24 20:36:55 -04:00
Alexander Belopolsky cd28013d00 Reindented Lib/test/datetimetester.py. 2016-07-24 14:41:08 -04:00
Alexander Belopolsky 4719ae7567 Issue #24773: Made ZoneInfoCompleteTest a TestSuit.
This should improve the diagnostic and progress reports.
2016-07-24 14:39:28 -04:00
Alexander Belopolsky 8dadb2155b Issue 24773: Make zoneinfo tests more robust. 2016-07-23 11:16:56 -04:00
Alexander Belopolsky 5d0c598382 Closes issue #24773: Implement PEP 495 (Local Time Disambiguation). 2016-07-22 18:47:04 -04:00
Martin Panter 3e04d5b306 Issue #27076: Merge spelling from 3.5 2016-05-26 06:03:19 +00:00
Martin Panter 46f50726a0 Issue #27076: Doc, comment and tests spelling fixes
Most fixes to Doc/ and Lib/ directories by Ville Skyttä.
2016-05-26 05:35:26 +00:00
Alexander Belopolsky 16b698b095 merge 2016-03-25 15:46:55 -04:00
Alexander Belopolsky 1dcf4f9ee5 Issue#26616:Fixed a bug in datetime.astimezone() method. 2016-03-25 15:42:59 -04:00
Berker Peksag 02cce69217 Issue #19265: Improve test coverage of datetime.tzinfo
Without the patch, line 1010 of Lib/datetime.py wasn't covered
by the test suite.

Patch by Colin Williams.
2016-03-19 13:16:52 +02:00
Berker Peksag e3385b4e3d Issue #19265: Improve test coverage of datetime.tzinfo
Without the patch, line 1010 of Lib/datetime.py wasn't covered
by the test suite.

Patch by Colin Williams.
2016-03-19 13:16:32 +02:00
Victor Stinner 15a83e845f Revert change 291d47954618
Revert:
"Always test datetime.strftime("%4Y")

Issue #13305: Always test datetime.datetime.strftime("%4Y") for years < 1900."

In fact, strftime("%4Y") fails on most platforms.
2016-03-12 08:16:48 +01:00
Victor Stinner 474ebbbe50 Always test datetime.strftime("%4Y")
Issue #13305: Always test datetime.datetime.strftime("%4Y") for years < 1900.
2016-03-11 22:36:14 +01:00
Alexander Belopolsky a2998a63c8 Closes #19475: Added timespec to the datetime.isoformat() method.
Added an optional argument timespec to the datetime isoformat() method
to choose the precision of the time component.

Original patch by Alessandro Cucci.
2016-03-06 14:58:43 -05:00
Serhiy Storchaka d0c1f7743d Issue #26198: Make datetime error tests more lenient. 2016-02-08 09:26:57 +02:00
Serhiy Storchaka 0c0d537b24 Issue #26198: Make datetime error tests more lenient. 2016-02-08 09:25:53 +02:00
Martin Panter fca22327ca Issue #20220: Revert time zone test debugging, revision 139c18943d9b 2015-11-16 09:22:19 +00:00
Serhiy Storchaka 51eca24748 Issue #9051: Added tests for pickling and copying the timezone objects. 2015-11-16 11:20:17 +02:00
Serhiy Storchaka f242aebbd3 Issue #9051: Added tests for pickling and copying the timezone objects. 2015-11-16 11:19:31 +02:00
Serhiy Storchaka e28209f251 Issue #9051: Added tests for pickling and copying the timezone objects. 2015-11-16 11:12:58 +02:00
Martin Panter 63c1ebb67b Issue #25168: Temporary timezone and cache debugging 2015-11-14 08:54:30 +00:00
Alexander Belopolsky 365ba8f6c1 Closes issue #23600: Wrong results from tzinfo.fromutc(). 2015-09-27 22:32:15 -04:00
Alexander Belopolsky edc6885b3f Closes issue #23600: Wrong results from tzinfo.fromutc(). 2015-09-27 22:31:45 -04:00
Alexander Belopolsky d19b5042ff Closes issue #23600: Wrong results from tzinfo.fromutc(). 2015-09-27 21:56:53 -04:00
Alexander Belopolsky c58c2cb392 Closes issue #23600: Wrong results from tzinfo.fromutc(). 2015-09-27 21:56:09 -04:00
Alexander Belopolsky c79447b267 Closes issue #23600: Wrong results from tzinfo.fromutc(). 2015-09-27 21:41:55 -04:00
Victor Stinner 5ebfe42cdf Oops, fix test_microsecond_rounding()
Test self.theclass, not datetime. Regression introduced by manual tests.
2015-09-18 14:52:15 +02:00
Victor Stinner 84ff4abd79 Merge 3.4 (datetime rounding) 2015-09-18 14:50:18 +02:00
Victor Stinner 511491ade0 Issue #23517: Fix rounding in fromtimestamp() and utcfromtimestamp() methods
of datetime.datetime: microseconds are now rounded to nearest with ties going
to nearest even integer (ROUND_HALF_EVEN), instead of being rounding towards
zero (ROUND_DOWN). It's important that these methods use the same rounding
mode than datetime.timedelta to keep the property:

   (datetime(1970,1,1) + timedelta(seconds=t)) == datetime.utcfromtimestamp(t)

It also the rounding mode used by round(float) for example.

Add more unit tests on the rounding mode in test_datetime.
2015-09-18 14:42:05 +02:00
Victor Stinner cd5d765b0e cleanup datetime code
remove scories of round half up code and debug code.
2015-09-09 01:09:21 +02:00
Victor Stinner 7667f58151 Issue #23517: fromtimestamp() and utcfromtimestamp() methods of
datetime.datetime now round microseconds to nearest with ties going to nearest
even integer (ROUND_HALF_EVEN), as round(float), instead of rounding towards
-Infinity (ROUND_FLOOR).

pytime API: replace _PyTime_ROUND_HALF_UP with _PyTime_ROUND_HALF_EVEN. Fix
also _PyTime_Divide() for negative numbers.

_PyTime_AsTimeval_impl() now reuses _PyTime_Divide() instead of reimplementing
rounding modes.
2015-09-09 01:02:23 +02:00
Victor Stinner 69cc487df4 Revert change 0eb8c182131e:
"""Issue #23517: datetime.timedelta constructor now rounds microseconds to
nearest with ties going away from zero (ROUND_HALF_UP), as Python 2 and Python
older than 3.3, instead of rounding to nearest with ties going to nearest even
integer (ROUND_HALF_EVEN)."""

datetime.timedelta uses rounding mode ROUND_HALF_EVEN again.
2015-09-08 23:58:54 +02:00
Alexander Belopolsky 7827a5b7c2 Closes Issue#22241: timezone.utc name is now plain 'UTC', not 'UTC-00:00'. 2015-09-06 13:07:21 -04:00
Victor Stinner 8820a350d7 Issue #23517: Skip a datetime test on Windows
The test calls gmtime(-1)/localtime(-1) which is not supported on Windows.
2015-09-05 10:50:20 +02:00
Victor Stinner adfefa527a Issue #23517: Fix implementation of the ROUND_HALF_UP rounding mode in
datetime.datetime.fromtimestamp() and datetime.datetime.utcfromtimestamp().
microseconds sign should be kept before rounding.
2015-09-04 23:57:25 +02:00
Victor Stinner 2ec5bd6fb2 Issue #23517: fromtimestamp() and utcfromtimestamp() methods of
datetime.datetime now round microseconds to nearest with ties going away from
zero (ROUND_HALF_UP), as Python 2 and Python older than 3.3, instead of
rounding towards -Infinity (ROUND_FLOOR).
2015-09-03 09:06:44 +02:00
Victor Stinner 2ec558739e Issue #23517: datetime.timedelta constructor now rounds microseconds to nearest
with ties going away from zero (ROUND_HALF_UP), as Python 2 and Python older
than 3.3, instead of rounding to nearest with ties going to nearest even
integer (ROUND_HALF_EVEN).
2015-09-02 19:16:07 +02:00
Zachary Ware 38c707e7e0 Issue #21741: Update 147 test modules to use test discovery.
I have compared output between pre- and post-patch runs of these tests
to make sure there's nothing missing and nothing broken, on both
Windows and Linux.  The only differences I found were actually tests
that were previously *not* run.
2015-04-13 15:00:43 -05:00
Alexander Belopolsky 184291aeb7 Fixes #23521: Corrected pure python implementation of timedelta division.
* Eliminated OverflowError from timedelta * float for some floats;
 * Corrected rounding in timedlta true division.
2015-02-28 10:44:47 -05:00
Alexander Belopolsky 24d3deefcf Fixes #23521: Corrected pure python implementation of timedelta division.
* Eliminated OverflowError from timedelta * float for some floats;
 * Corrected rounding in timedlta true division.
2015-02-28 10:41:57 -05:00
Serhiy Storchaka 08448a1f4d Issue #23326: Removed __ne__ implementations. Since fixing default __ne__
implementation in issue #21408 they are redundant.
2015-01-31 12:05:05 +02:00
Serhiy Storchaka 65ee4674e2 Issue #22777: Test pickling with all protocols. 2014-12-15 14:06:02 +02:00
Serhiy Storchaka bad1257c96 Issue #22777: Test pickling with all protocols. 2014-12-15 14:03:42 +02:00
Antoine Pitrou 392f4139b3 Make test_datetime a better citizen (issue #22540) 2014-10-03 11:25:30 +02:00
Alexander Belopolsky 6c7a4182f5 Closes issue #20858: Enhancements/fixes to pure-python datetime module
This patch brings the pure-python datetime more in-line with the C
module.  Patch contributed by Brian Kearns, a PyPy developer.  PyPy
project has been running these modifications in PyPy2 stdlib.

This commit includes:

- General PEP8/cleanups;
- Better testing of argument types passed to constructors;
- Removal of duplicate operations;
- Optimization of timedelta creation;
- Caching the result of __hash__ like the C accelerator;
- Enhancements/bug fixes in tests.
2014-09-28 19:11:56 -04:00
Raymond Hettinger a22d8231a3 merge 2014-07-25 15:00:30 -07:00
Raymond Hettinger 5a2146a2fd Issue #22044: Fixed premature DECREF in call_tzinfo_method. 2014-07-25 14:59:48 -07:00
Benjamin Peterson ee6bdc07d6 remove the ability of datetime.time to be considered false (closes #13936) 2014-03-20 18:00:35 -05:00
Zachary Ware 101d9e7250 Issue 19572: More silently skipped tests explicitly skipped. 2013-12-08 00:44:27 -06:00
Zachary Ware 9fe6d86709 Issue 19572: More silently skipped tests explicitly skipped. 2013-12-08 00:20:35 -06:00
Serhiy Storchaka 9289713c0b Issue #19605: Use specific asserts in datetime tests 2013-11-17 13:03:07 +02:00
Serhiy Storchaka 3df4dcceb9 Issue #19605: Use specific asserts in datetime tests 2013-11-17 12:52:33 +02:00
Ezio Melotti a7e7497d88 #18466: merge with 3.3. 2013-08-17 16:58:13 +03:00
Ezio Melotti 85a8629d21 #18466: fix more typos. Patch by Févry Thibault. 2013-08-17 16:57:41 +03:00
Alexander Belopolsky 790d269d39 Fixes #8860: Round half-microseconds to even in the timedelta constructor.
(Original patch by Mark Dickinson.)
2013-08-04 14:51:35 -04:00
Georg Brandl 0085a24075 Closes #15973: fix a segmentation fault when comparing timezone objects. 2012-09-22 09:23:12 +02:00
Alexander Belopolsky 93c9cd07b6 Issue #9527: tm_gmtoff has 'correct' sign. 2012-06-22 16:04:19 -04:00
Alexander Belopolsky ff493c9c46 Issue #9527: datetime.astimezone() method will now supply a class
timezone instance corresponding to the system local timezone when
called with no arguments.
2012-06-22 12:25:57 -04:00
Alexander Belopolsky fdc860f310 Issue #9527: datetime.astimezone() method will now supply a class
timezone instance corresponding to the system local timezone when
called with no arguments.
2012-06-22 12:23:23 -04:00
Alexander Belopolsky 0831382d69 Issue #15006: Allow equality comparison between naive and aware time
or datetime objects.
2012-06-15 20:19:47 -04:00
Alexander Belopolsky f6f56183ee Relax datetime.timestamp() test around DST change 2012-06-08 13:00:27 -04:00
Alexander Belopolsky 0c687e5e88 Relax datetime.timestamp() test around DST change 2012-06-08 12:58:31 -04:00
Alexander Belopolsky a4415141da Issue #2736: Added datetime.timestamp() method. 2012-06-08 12:33:09 -04:00
Victor Stinner 8050ca9c6f Issue #14180: TestDateTime.test_microsecond_rounding() handles localtime() and
gmtime() failure on Windows
2012-03-14 00:17:05 +01:00
Victor Stinner 5d272cc6a2 Close #14180: Factorize code to convert a number of seconds to time_t, timeval or timespec
time.ctime(), gmtime(), time.localtime(), datetime.date.fromtimestamp(),
datetime.datetime.fromtimestamp() and datetime.datetime.utcfromtimestamp() now
raises an OverflowError, instead of a ValueError, if the timestamp does not fit
in time_t.

datetime.datetime.fromtimestamp() and datetime.datetime.utcfromtimestamp() now
round microseconds towards zero instead of rounding to nearest with ties going
away from zero.
2012-03-13 13:35:55 +01:00
Georg Brandl 2fb477c0f0 Merge 3.2: Issue #13703 plus some related test suite fixes. 2012-02-21 00:33:36 +01:00
Georg Brandl e5a0e0a75f Fix obscure failures of datetime-related tests due to the datetime tests failing to restore the system state completely after testing the pure-Python versions. 2012-02-20 23:37:36 +01:00
Florent Xicluna 49ce06858b Strengthen the tests for format '%Y', in relation with issue #13305. 2011-11-01 12:56:14 +01:00
Alexander Belopolsky 4409493d73 Relax %Y test. 2011-05-02 13:48:09 -04:00
Alexander Belopolsky 89da349b7b Issue #11930: Remove year >= 1000 limitation from datetime.strftime.
Patch by Victor Stinner.
2011-05-02 13:14:24 -04:00
Alexander Belopolsky b6f5ec7370 Issue #11576: Fixed timedelta subtraction glitch on big timedelta values 2011-04-05 20:07:38 -04:00
Ezio Melotti 3b3499ba69 #11565: Merge with 3.1. 2011-03-16 11:35:38 +02:00
Alexander Belopolsky b8bb4664fc Issue #1777412: extended year range of strftime down to 1000. 2011-01-08 00:13:34 +00:00
Raymond Hettinger 7beae8a0d5 Issue 10825: Minor updates to the test suite. 2011-01-06 05:34:17 +00:00
Alexander Belopolsky e239d23e8c Issue #6697: Fixed instances of _PyUnicode_AsString() result not checked for NULL 2010-12-08 23:31:48 +00:00
Eric Smith 3ab08cadae Issue #10624: Use support.requires_IEEE_754 in all appropriate tests. 2010-12-04 15:17:38 +00:00
Alexander Belopolsky 1bcbaab15a Issue 9183: Intern UTC timezone. 2010-10-14 17:03:51 +00:00
Alexander Belopolsky 3e62f78c4e Fixed microsecond rounding in python version of utcfromtimestamp 2010-09-21 16:30:56 +00:00
Georg Brandl 38005e8156 #9440: Remove borderline test case that fails based on unpredictable conditions such as compiler flags. 2010-07-31 18:11:07 +00:00