Commit Graph

31 Commits

Author SHA1 Message Date
Brett Cannon 6eeaddc341 Convert test_strftime, test_getargs, and test_pep247 to use unittest. 2008-03-18 01:00:07 +00:00
Christian Heimes c5f05e45cf Patch #2167 from calvin: Remove unused imports 2008-02-23 17:40:11 +00:00
Brett Cannon c82208eecb Deal with case of when locale time values has characters that can be mistaken
for regex syntax.
Fixes bug #883604 .
2004-03-20 23:09:40 +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
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 54e54c6877 The first batch of changes recommended by the fixdiv tool. These are
mostly changes of / operators into //.  Once or twice I did more or
less than recommended.
2001-09-04 19:14:14 +00:00
Barry Warsaw 2108bc7ab0 main(): Application of SF patch #405851, which allows this test to be
used by Jython.  The tests in this module expect C locale, so be
explicit about setting that (for CPython).  However, in Jython, there
is no C locale, so instead be explicit about setting the US locale.
Closes the patch.
2001-03-23 20:24:07 +00:00
Eric S. Raymond 83ff749827 String method conversion. 2001-02-09 12:03:45 +00:00
Fredrik Lundh f785042433 a bold attempt to fix things broken by MAL's verify patch: import
'verify' iff it's used by a test module...
2001-01-17 21:51:36 +00:00
Marc-André Lemburg 3661908a6a This patch removes all uses of "assert" in the regression test suite
and replaces them with a new API verify(). As a result the regression
suite will also perform its tests in optimization mode.

Written by Marc-Andre Lemburg. Copyright assigned to Guido van Rossum.
2001-01-17 19:11:13 +00:00
Jack Jansen 00ce51e38e Allow am/pm as well as AM/PM (C9X behaviour). 2000-09-15 12:57:35 +00:00
Guido van Rossum 0b7dd08d50 # Bah. The same problem occurred a second time. 1999-04-08 20:22:46 +00:00
Guido van Rossum 9b112799bc On Windows, we suddenly find, strftime() may return "" for an
unsupported format string.  (I guess this is because the logic for
deciding whether to reallocate the buffer or not has been improved.)
This caused the test code to crash on result[0].  Fix this by assuming
an empty result also means the format is not supported.
1999-04-08 17:23:11 +00:00
Guido van Rossum 7944ea523e Patch by Marc-Andre Lemburg: use re module to compare test results.
This makes it possible to accept that on Linux %w returns "01" instead
of "1", for example.
1998-09-14 15:50:40 +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 92d91f56a7 Move %x test to nonstandard section because it appears to be locale specific. 1997-12-15 18:06:19 +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 2b41fdccd3 Moved some non-standard format characters out of the standard list.
Also moved %c and %Z out of there, even though they are standard,
because these are locale dependent (and e.g. on Windows and Mac they
return different strings).  Finally, sorted the tables slightly
different, to match my standard docs better (%a before %A).
1997-08-14 22:23:42 +00:00
Guido van Rossum 9d9af2c7a8 Fixes for the Mac. (Jack) 1997-08-12 18:21:08 +00:00
Guido van Rossum 3f11da0aaf Changes to make these tests work on the Mac. 1997-05-16 13:51:48 +00:00
Guido van Rossum 4dfd458611 Fix typo in error reporting. 1997-05-14 21:38:03 +00:00
Guido van Rossum 62bd30c430 Catch and report ValueError raised by strftime. 1997-04-11 22:26:42 +00:00
Guido van Rossum e69be3eb93 Much more rigorous testing -- we now try many times, varying in time
of day, day of week, and season.

Fix the weekday predictions -- these seemed to be all bogus.  The new
predictions seem to correspond with strftime() on Solaris and IRIX, so
I believe they are correct.

Get rid of the test for non-standard format %C returning "the same as
date(1)".  This is hard to do reliably without opening a pipe to date,
and moreover, on IRIX 6.2, %C yields the Century.  So we use that
instead.  (We don't complain about this in non-verbose mode anyway.)
1997-03-07 20:30:03 +00:00
Guido van Rossum 13ddde0653 Remove %n and %t from the list of standard expectations. 1997-02-19 16:25:52 +00:00
Guido van Rossum 2bde783a97 Import verbose flag from test_support instead of testing __name__. 1996-12-20 03:03:39 +00:00
Guido van Rossum 5eaf457869 Different operation in verbose mode: show the supported nonstandard
options.  Also added two: %n and %t (newline and tab character).
1996-12-18 18:03:10 +00:00
Barry Warsaw 2cc8163e30 nonstandard_expectations is only added when in verbose mode, so we
don't need the if test for verbosity when checking for results of an
unsupported option.
1996-12-13 18:12:34 +00:00
Barry Warsaw 4c23b5fdbc Hmm, now that I think about it, we *can* use time.time() and 'date' if
running verbose.
1996-12-13 18:08:58 +00:00
Barry Warsaw 4eb01cd372 More or less portabilized.
1. If a conversion isn't supported on the current platform, just
   ignore it, unless running as a script (i.e. verbose)

2. Don't use time.time() and os.popen('date') to get the raw values.
   These will always be different!
1996-12-13 18:07:07 +00:00
Guido van Rossum 15d1079dd2 Fixed test_strftime to be silent when called from autotest. 1996-12-12 19:07:19 +00:00
Guido van Rossum 483705c5a9 Added test_strftime (Skip Montanaro). 1996-12-12 19:03:11 +00:00