Commit Graph

91 Commits

Author SHA1 Message Date
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