summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_datetime.py
Commit message (Collapse)AuthorAgeFilesLines
* [2.7] bpo-35021: Fix assertion failures in _datetimemodule.c. (GH-10039) ↵Serhiy Storchaka2018-11-201-35/+58
| | | | | | | | | | | | | (GH-10617) Fixes assertion failures in _datetimemodule.c introduced in the previous fix (see bpo-31752). Rather of trying to handle an int subclass as exact int, let it to use overridden special methods, but check the result of divmod(). (cherry picked from commit 3ec0f495163da3b7a15deb2805cec48aed432f58) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [2.7] bpo-31752: Fix possible crash in timedelta constructor called with ↵Serhiy Storchaka2017-10-231-0/+40
| | | | | | custom integers. (GH-3947) (#4088) Bad remainder in divmod() in intermediate calculations caused an assertion failure.. (cherry picked from commit 4ffd4653a7ec9c97775472276cf5e159e2366bb2)
* Issue #27895: Spelling fixes (Contributed by Ville Skyttä).Martin Panter2016-09-071-1/+1
|
* Issue #27076: Doc, comment and test function name spelling fixesMartin Panter2016-05-261-2/+2
| | | | Most fixes to Doc/ and Lib/ directories by Ville Skyttä.
* Issue #22777: Test pickling with all protocols.Serhiy Storchaka2014-12-151-5/+6
|
* Issue #19605: Use specific asserts in datetime testsSerhiy Storchaka2013-11-171-81/+81
|
* #18466: fix more typos. Patch by Févry Thibault.Ezio Melotti2013-08-171-1/+1
|
* Issue #11576: Fixed timedelta subtraction glitch on big timedelta valuesAlexander Belopolsky2011-04-061-0/+7
|
* #11565: Fix several typos. Patch by Piotr Kasprzyk.Ezio Melotti2011-03-161-1/+1
|
* Merged revisions 86596 via svnmerge fromEzio Melotti2010-11-211-3/+3
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r86596 | ezio.melotti | 2010-11-20 21:04:17 +0200 (Sat, 20 Nov 2010) | 1 line #9424: Replace deprecated assert* methods in the Python test suite. ........
* Issue #7150: Raise OverflowError if the result of adding or subtractingAlexander Belopolsky2010-05-271-9/+10
| | | | timedelta from date or datetime falls outside of the MINYEAR:MAXYEAR range.
* Issue #7879: Skip negative timestamps test on any Windows platformAlexander Belopolsky2010-05-261-7/+2
| | | | using unittest.skipIf decorator.
* Issue #7879: Do not test negative timestamps on any Windows platformAlexander Belopolsky2010-05-261-3/+3
| | | | including Windows CE.
* Issue #8644: Improve accuracy of timedelta.total_seconds method.Mark Dickinson2010-05-091-1/+8
| | | | (Backport of r80979 to py3k.) Thanks Alexander Belopolsky.
* use assert[Not]IsInstance where appropriateEzio Melotti2010-01-241-16/+15
|
* use assert[Not]In where appropriateEzio Melotti2010-01-231-5/+2
|
* #7413: Passing '\0' as the separator to datetime.datetime.isoformat()Amaury Forgeot d'Arc2009-12-291-0/+1
| | | | used to drop the time part of the result.
* Issue #5788: `datetime.timedelta` objects get a new `total_seconds()` method ↵Antoine Pitrou2009-11-251-0/+7
| | | | | | returning the total number of seconds in the duration. Patch by Brian Quinlan.
* convert usage of fail* to assert*Benjamin Peterson2009-06-301-179/+179
|
* Fix recently introduced test cases.Kristján Valur Jónsson2009-01-151-3/+12
| | | | | For datetime, gentoo didn't seem to mind the %e format for strftime. So, we just excercise those instead making sure that we don't crash. For test_os, two cases were incorrect.
* Add tests for invalid format specifiers in strftime, and for handling of ↵Kristján Valur Jónsson2009-01-121-0/+8
| | | | invalid file descriptors in the os module.
* Typo fixAndrew M. Kuchling2008-10-031-1/+1
|
* Issue 2235: Py3k warnings are now emitted for classes that will no longer ↵Nick Coghlan2008-08-111-0/+1
| | | | inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
* Fix issue 2782: be less strict about the format string type in strftime.Gregory P. Smith2008-06-021-0/+4
| | | | | Accept unicode and anything else ParseTuple "s#" can deal with. This matches the time.strftime behavior.
* add %f format to datetime - issue 1158Skip Montanaro2008-03-151-8/+9
|
* Patch #2167 from calvin: Remove unused importsChristian Heimes2008-02-231-1/+0
|
* Backport of PEP 3101, Advanced String Formatting, from py3k.Eric Smith2008-02-171-0/+76
| | | | | | | | | | | | | | | Highlights: - Adding PyObject_Format. - Adding string.Format class. - Adding __format__ for str, unicode, int, long, float, datetime. - Adding builtin format. - Adding ''.format and u''.format. - str/unicode fixups for formatters. The files in Objects/stringlib that implement PEP 3101 (stringdefs.h, unicodedefs.h, formatter.h, string_format.h) are identical in trunk and py3k. Any changes from here on should be made to trunk, and changes will propogate to py3k).
* Fix silly typo in test name.Guido van Rossum2007-08-241-1/+1
|
* Remove functionality from test_datetime.test_main() that does reference ↵Collin Winter2007-04-251-20/+1
| | | | count checking; 'regrtest.py -R' is the way to do this kind of testing.
* Standardize on test.test_support.run_unittest() (as opposed to a mix of ↵Collin Winter2007-04-251-26/+8
| | | | run_unittest() and run_suite()). Also, add functionality to run_unittest() that admits usage of unittest.TestLoader.loadTestsFromModule().
* Windows doesn't support negative timestamps. Skip the tests involving themGuido van Rossum2007-03-071-0/+7
| | | | if os.name == "nt".
* Patch #1646728: datetime.fromtimestamp fails with negativeGuido van Rossum2007-03-061-0/+9
| | | | | | fractional times. With unittest. Somebody please backport to 2.5.
* Bug #1653736: Complain about keyword arguments to time.isoformat.Martin v. Löwis2007-02-081-0/+5
| | | | Will backport to 2.5.
* Bug #1556784: allow format strings longer than 127 characters inGeorg Brandl2006-09-301-0/+1
| | | | datetime's strftime function.
* Bug #1478429: make datetime.datetime.fromtimestamp accept every float,Georg Brandl2006-04-281-0/+6
| | | | possibly "rounding up" to the next whole second.
* Fix problem spotted by Coverity that occurs if tzinfo.tzname().replace()Neal Norwitz2006-03-201-0/+11
| | | | | | returns a non-string when converting %Z. Will backport.
* similar to SF bug 847019: a quick check in the time() constructor, whichArmin Rigo2005-11-071-0/+7
| | | | | | accepts strings only for unpickling reasons. This check prevents the honest mistake of passing a string like '2:59.0' to time() and getting an insane object.
* Use descriptors.Guido van Rossum2005-01-161-1/+1
|
* Add strptime() constructor to datetime class. Thanks to Josh Spoerri forSkip Montanaro2005-01-131-0/+9
| | | | the changes.
* SF bug #1028306: date-datetime comparisonTim Peters2004-09-161-0/+43
| | | | Treat comparing a date to a datetime like a mixed-type comparison.
* Bug 975996: Add _PyTime_DoubleToTimet to C APITim Peters2004-06-201-0/+27
| | | | | | | | | | | New include file timefuncs.h exports private API function _PyTime_DoubleToTimet() from timemodule.c. timemodule should export some other functions too (look for painful bits in datetimemodule.c). Added insane-argument checking to datetime's assorted fromtimestamp() and utcfromtimestamp() methods. Added insane-argument tests of these to test_datetime, and insane-argument tests for ctime(), localtime() and gmtime() to test_time.
* SF 952807: Unpickling pickled instances of subclasses of datetime.date,Tim Peters2004-06-071-0/+34
| | | | | | | datetime.datetime and datetime.time could yield insane objects. Thanks to Jiwon Seo for the fix. Bugfix candidate. I'll backport it to 2.3.
* SF bug 847019 datetime.datetime initialization needs more strict checkingTim Peters2004-03-211-0/+20
| | | | | | | | | It's possible to create insane datetime objects by using the constructor "backdoor" inserted for fast unpickling. Doing extensive range checking would eliminate the backdoor's purpose (speed), but at least a little checking can stop honest mistakes. Bugfix candidate.
* SF bug #761337: datetime.strftime fails on trivial format stringRaymond Hettinger2003-06-271-0/+1
| | | | | | | | | | | | | | The interning of short strings violates the refcnt==1 assumption for _PyString_Resize(). A simple fix is to boost the initial value of "totalnew" by 1. Combined with an NULL argument to PyString_FromStringAndSize(), this assures that resulting format string is not interned. This will remain true even if the implementation of PyString_FromStringAndSize() changes because only the uninitialized strings that can be interned are those of zero length. Added a test case.
* datetime.timedelta is now subclassable in Python. The new test showsTim Peters2003-05-171-0/+31
| | | | | | | | one good use: a subclass adding a method to express the duration as a number of hours (or minutes, or whatever else you want to add). The native breakdown into days+seconds+us is often clumsy. Incidentally moved a large chunk of object-initialization code closer to the top of the file, to avoid worse forward-reference trickery.
* datetime.datetime and datetime.time can now be subclassed in Python. Brr.Tim Peters2003-05-171-31/+131
|
* test_subclass_date(): Beefed this up, to check that new instanceTim Peters2003-05-171-2/+28
| | | | | | | attributes and methods work, that new arguments can be passed to the constructor, and that inherited methods and attrs still work. Added XXX comments about what to do when datetime becomes usably subclassable too (it's not yet).
* The date class is now properly subclassable. (SF bug #720908)Guido van Rossum2003-04-141-0/+6
| | | | | (This is only the tip of the iceberg; the time and datetime classes need the same treatment.)
* Whitespace normalization.Tim Peters2003-02-191-11/+11
|
* The Python implementation of datetime was changed in ways that no longerTim Peters2003-02-081-31/+10
| | | | | | | tickle the 2.2.2 __cmp__ bug test_datetime used to tickle, so the workarounds for that bug no longer make sense in the test suite (which I'm still trying to keep as closely in synch as possible with Zope3's version).