Commit Graph

23 Commits

Author SHA1 Message Date
Brett Cannon 4d94743c28 When range checking was added to time.strftime() a check was placed on tm_isdst
to make sure it fell within [-1, 1] just in case someone implementing
strftime() in libc was stupid enough to assume this. Turns out, though, some
OSs (e.g. zOS) are stupid enough to use values outside of this range for time
structs created by the system itself. So instead of throwing a ValueError,
tm_isdst is now normalized before being passed to strftime().

Fixes issue #6823. Thanks Robert Shapiro for diagnosing the problem and
contributing an initial patch.
2009-09-22 00:29:48 +00:00
Benjamin Peterson 5c8da86f3a convert usage of fail* to assert* 2009-06-30 22:57:08 +00:00
Brett Cannon e042601251 Make output on test_strptime() be more verbose in face of failure. This is in
hopes that more information will help debug the failing test on HPPA Ubuntu.
2006-09-23 19:53:20 +00:00
Brett Cannon caebe22038 Fix bug #1520914. Starting in 2.4, time.strftime() began to check the bounds
of values in the time tuple passed in.  Unfortunately people came to rely on
undocumented behaviour of setting unneeded values to 0, regardless of if it was
within the valid range.  Now those values force the value internally to the
minimum value when 0 is passed in.
2006-07-18 04:41:36 +00:00
Neal Norwitz de7f502879 Try to narrow window of failure on slow/busy boxes (ppc64 buildbot) 2006-06-15 05:55:49 +00:00
Fred Drake f901abdd62 allow ctime(), gmtime(), and localtime() to take None as equivalent to an omitted arg
(closes SF bug #658254, patch #663482)
2004-08-03 17:58:55 +00:00
Tim Peters 1b6f7a9057 Bug 975996: Add _PyTime_DoubleToTimet to C API
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.
2004-06-20 02:50:16 +00:00
Brett Cannon d1080a3418 Have strftime() check its time tuple argument to make sure the tuple's values
are within proper boundaries as specified in the docs.

This can break possible code (datetime module needed changing, for instance)
that uses 0 for values that need to be greater 1 or greater (month, day, and
day of year).

Fixes bug #897625.
2004-03-02 04:38:10 +00:00
Tim Peters 0eadaac7dc Whitespace normalization. 2003-04-24 16:02:54 +00:00
Neal Norwitz 7f2588c073 SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Update configure and test to use proper timezone specifications
2003-04-11 15:35:53 +00:00
Guido van Rossum d2b738ee7d If time.tzset doesn't exist, don't test it. 2003-03-15 12:01:52 +00:00
Guido van Rossum d11b62edd0 - New function time.tzset() provides access to the C library tzet()
function, if supported.  (SF patch #675422, by Stuart Bishop.)
2003-03-14 21:51:36 +00:00
Barry Warsaw 04f357cffe Get rid of relative imports in all unittests. Now anything that
imports e.g. test_support must do so using an absolute package name
such as "import test.test_support" or "from test import test_support".

This also updates the README in Lib/test, and gets rid of the
duplicate data dirctory in Lib/test/data (replaced by
Lib/email/test/data).

Now Tim and Jack can have at it. :)
2002-07-23 19:04:11 +00:00
Guido van Rossum 00efe7e798 Pure Python strptime implementation by Brett Cannon. See SF patch 474274.
Also adds tests.
2002-07-19 17:04:46 +00:00
Barry Warsaw 4eaf50f435 test_mktime(): Removed. This wasn't really testing anything useful
(or platform independent).  Closes SF bug #460357.

Bug fix candidate.
2002-04-16 12:37:55 +00:00
Fred Drake 2e2be3760c Change the PyUnit-based tests to use the test_main() approach. This
allows using the tests with unittest.py as a script.  The tests will
still run when run as a script themselves.
2001-09-20 21:33:42 +00:00
Fred Drake bc5619826e Convert time module tests to PyUnit. 2001-05-22 17:02:02 +00:00
Fred Drake 132dce2246 Update the code to better reflect recommended style:
Use != instead of <> since <> is documented as "obsolescent".
Use "is" and "is not" when comparing with None or type objects.
2000-12-12 23:11:42 +00:00
Guido van Rossum 41360a4696 Mass check-in after untabifying all files that need it. 1998-03-26 19:42:58 +00:00
Guido van Rossum 6a99984e79 Use long() instead of int() to compare mktime(localtime(t) with t... 1997-12-08 21:48:01 +00:00
Guido van Rossum e7038425b1 Tweaks to cope with strftime returning 0 without error for %Z 1997-08-18 15:37:38 +00:00
Guido van Rossum ad183bbfe6 Removed nonstandard strftime formats (strftime is tested more
extensively in test_strftime.py anyway).
1997-02-20 16:23:01 +00:00
Barry Warsaw b0c2232011 test of time module. not terribly fancy, but it does touch every
function and variable in the module, verifies a few return values and
even tests a couple of known error conditions.
1996-12-06 23:30:07 +00:00