summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_strptime.py
Commit message (Collapse)AuthorAgeFilesLines
* add %f format to datetime - issue 1158Skip Montanaro2008-03-151-30/+36
|
* Make _strptime.TimeRE().pattern() use ``\s+`` for matching whitespace insteadBrett Cannon2007-06-031-0/+9
| | | | | | | of ``\s*``. This prevents patterns from "stealing" bits from other patterns in order to make a match work. Closes bug #1730389. Will be backported.
* Fix the test for recreating the locale cache object by not worrying about ifBrett Cannon2007-04-011-4/+16
| | | | one of the test locales cannot be set.
* time.strptime's caching of its locale object was being recreated when theBrett Cannon2007-04-011-0/+17
| | | | | | | | | locale changed but not used during the function call it was recreated during. The test in this checkin is untested (OS X does not have the proper locale support for me to test), although the fix for the bug this deals with was tested by the OP (#1290505). Once the buildbots verify the test at least doesn't fail it becomes a backport candidate.
* Fix time.strptime's %U support. Basically rewrote the algorithm to be moreBrett Cannon2007-01-251-0/+4
| | | | | | | | | generic so that one only has to shift certain values based on whether the week was specified to start on Monday or Sunday. Cut out a lot of edge case code compared to the previous version. Also broke algorithm out into its own function (that is private to the module). Fixes bug #1643943 (thanks Biran Nahas for the report).
* Change time.strptime() to raise ValueError whenever there is an error in theBrett Cannon2005-11-021-2/+12
| | | | | | | format string. Before exceptions generated by the internal code propagated up to the user and were not helpful. Closes bug #1340337.
* Clear out the regex cache when the TimeRE cache is invalidated by a localeBrett Cannon2005-09-151-0/+2
| | | | | | change. Fixes bug #1290505.
* Fix bug of implementation of algorithm for calculating the date from year, weekBrett Cannon2004-10-281-3/+18
| | | | | | | | of the year, and day of the week. Was not taking into consideration properly the issue of when %U is used for the week of the year but the year starts on Monday. Closes bug #1045381 again.
* Add support for %U and %W to contribute to calculating the date when the yearBrett Cannon2004-10-181-0/+22
| | | | | | and day of the week are specified. Closes bug #1045381.
* Locale data that contains regex metacharacters are now properly escaped.Brett Cannon2004-10-061-0/+13
| | | | Closes bug #1039270.
* It helps when doing checks if something is in a tuple of strings that if youBrett Cannon2004-07-141-1/+1
| | | | put everything in the tuple in caps to use str.upper() instead of str.lower().
* Fix test case for when time.tzname[0] is either UTC or GMT. Also have testBrett Cannon2004-07-121-2/+7
| | | | output more telling details when there is a failure.
* * Migrate set() and frozenset() from the sandbox.Raymond Hettinger2003-11-161-4/+3
| | | | | | | | * Install the unittests, docs, newsitem, include file, and makefile update. * Exercise the new functions whereever sets.py was being used. Includes the docs for libfuncs.tex. Separate docs for the types are forthcoming.
* Make sure parentheses are escaped when used in the format string.Brett Cannon2003-08-291-0/+9
| | | | Closes bug #796149 . Will be backported.
* Fix bug in test_bad_timezone where test was assuming locale knew of PDT.Brett Cannon2003-08-111-2/+3
|
* Fix handling of bad locale setup where time.tzname[0] == time.tzname[1] andBrett Cannon2003-08-111-0/+20
| | | | | | time.daylight is true. Add an explicit test for this situation. Fixed some wording in docstrings.
* Re-introduce caching of TimeRE and compiled regexes with added thread-safety.Brett Cannon2003-08-051-60/+54
| | | | | | | | | | | | Also remove now unnecessary property attributes for thread safety (no longer have lazy attributes) and code simplicity reasons. Timezone storage has been reworked to be simpler and more flexible. All values in LocaleTime instances are lower-cased. This is all done to simplify the module. The module now assumes nothing beyond the strptime function will be exposed for general use beyond providing functionality for strptime.
* Remove caching of TimeRE (and thus LocaleTime) instance. Error was beingBrett Cannon2003-07-241-7/+10
| | | | | | caught when executing test_strptime, test_logging, and test_time in that order when the testing of "%c" occured. Suspect the cache was not being recreated (the test passed when test_logging was forced to re-establish the locale).
* Fix error in test of not comparing against 0 item of a listBrett Cannon2003-07-221-1/+1
|
* Fixes bug of timezone value being left as -1 when ``time.tzname[0] ==Brett Cannon2003-07-031-3/+3
| | | | | | | time.tzname[1] and not time.daylight`` is true when it should only when time.daylight is true. Tests are also fixed. Closes bug #763047 and its cohort #763052.
* Fix typo in error messageNeal Norwitz2003-06-301-1/+1
|
* Removed invalid test.Raymond Hettinger2003-06-291-3/+0
| | | | | | | | | Analysis by Bob Halley: The test seems to expect that if time.daylight is true, then the is_dst field of the tm structure will be 1 too. But this isn't the case, since daylight is true if the timezone does DST, *not* if DST is in effect.
* Beefed up timezone support. UTC and GMT are now always recognized timezonesBrett Cannon2003-05-111-5/+14
| | | | | with values of 0. Also now check time.daylight to see if time.tzname[1] should be used in timezone checking.
* Combine the functionality of test_support.run_unittest()Walter Dörwald2003-05-011-8/+8
| | | | | | | | | | and test_support.run_classtests() into run_unittest() and use it wherever possible. Also don't use "from test.test_support import ...", but "from test import test_support" in a few spots. From SF patch #662807.
* Raise a ValueError when there is data that was not covered in the format ↵Brett Cannon2003-04-281-0/+4
| | | | string. Done to match behavior of pre-existing C-based strptime implementations.
* Make _strptime escape regex syntax in format string to prevent use in ↵Brett Cannon2003-04-191-0/+14
| | | | internal regex.
* SF patch #691928: Use datetime in _strptimeRaymond Hettinger2003-03-091-32/+38
| | | | | | | | | | | | Contributed by Brett Cannon. To prevent code duplication, I patched _strptime to use datetime's date object to do Julian day, Gregorian, and day of the week calculations. Patch also includes new regression tests to test results and the calculation gets triggered. Very minor comment changes and the contact email are also changed.
* SF patch 670012: Compatibility changes for _strptime.py.Tim Peters2003-01-181-47/+38
| | | | | | | | | | | | | | | Patch from Brett Cannon: First, the 'y' directive now handles [00, 68] as a suffix for the 21st century while [69, 99] is treated as the suffix for the 20th century (this is for Open Group compatibility). strptime now returns default values that make it a valid date ... the ability to pass in a regex object to use instead of a format string (and the inverse ability to have strptime return a regex object) has been removed. This is in preparation for a future patch that will add some caching internally to get a speed boost.
* Fix julian day problem with strptime. Note: XXX about using 0, suggestions?Neal Norwitz2002-12-261-0/+12
|
* Patch #639112: fixes for None locale and tz.Martin v. Löwis2002-11-271-56/+141
|
* Brett's fixes for various bugs and coding issues. Closes SF patch #Barry Warsaw2002-09-231-7/+26
| | | | | 593560, with some minor cleanups, line folding and whitespace normalization by Barry.
* Delete the %c test from test_date_time() untill Brett Cannon has timeGuido van Rossum2002-09-031-2/+2
| | | | | | to fix it. (It fails when the day of the month is a 1-digit number, because %c produces space+digit there, while strptime seems to expect zero+digit somehow.)
* The test I saw failing this morning just happened to be run at 8amBarry Warsaw2002-08-291-0/+12
| | | | | | | | localtime, which in -0400 is 12 noon GMT. The bug boiled down to broken conversion of 12 PM to hour 12 for the '%I %p' format string. Added a test for this specific condition: Strptime12AMPMTests. Fix to _strptime.py coming momentarily.
* Standardize behavior: no docstrings in test functions; add a properGuido van Rossum2002-08-221-46/+44
| | | | test_main() that creates a suite and runs it. Don't mess with sys.path!!!
* Whitespace normalization.Tim Peters2002-08-081-10/+10
|
* Pure Python strptime implementation by Brett Cannon. See SF patch 474274.Guido van Rossum2002-07-191-0/+279
Also adds tests.