diff options
author | Guido van Rossum <guido@python.org> | 1998-09-14 15:50:40 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-09-14 15:50:40 (GMT) |
commit | 7944ea523ed1da2cfa99c922509caa07114b4096 (patch) | |
tree | c1c3383b033de2233cf1020dad0b3631f7a841bd /Lib/test/test_strftime.py | |
parent | 09eea820050afd4e61dce30d3248efd089bf8400 (diff) | |
download | cpython-7944ea523ed1da2cfa99c922509caa07114b4096.zip cpython-7944ea523ed1da2cfa99c922509caa07114b4096.tar.gz cpython-7944ea523ed1da2cfa99c922509caa07114b4096.tar.bz2 |
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.
Diffstat (limited to 'Lib/test/test_strftime.py')
-rwxr-xr-x | Lib/test/test_strftime.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/test/test_strftime.py b/Lib/test/test_strftime.py index 7441a00..e24d5d6 100755 --- a/Lib/test/test_strftime.py +++ b/Lib/test/test_strftime.py @@ -2,7 +2,7 @@ # Sanity checker for time.strftime -import time, calendar, sys, string, os +import time, calendar, sys, string, os, re from test_support import verbose def main(): @@ -54,7 +54,7 @@ def strftest(now): ('%S', '%02d' % now[5], 'seconds of current time (00-60)'), ('%U', '%02d' % ((now[7] + jan1[6])/7), 'week number of the year (Sun 1st)'), - ('%w', '%d' % ((1+now[6]) % 7), 'weekday as a number (Sun 1st)'), + ('%w', '0?%d' % ((1+now[6]) % 7), 'weekday as a number (Sun 1st)'), ('%W', '%02d' % ((now[7] + (jan1[6] - 1)%7)/7), 'week number of the year (Mon 1st)'), # %x see below @@ -70,7 +70,7 @@ def strftest(now): ('%c', fixasctime(time.asctime(now)), 'near-asctime() format'), ('%x', '%02d/%02d/%02d' % (now[1], now[2], (now[0]%100)), '%m/%d/%y %H:%M:%S'), - ('(%Z)', '(%s)' % tz, 'time zone name'), + ('%Z', '%s' % tz, 'time zone name'), # These are some platform specific extensions ('%D', '%02d/%02d/%02d' % (now[1], now[2], (now[0]%100)), 'mm/dd/yy'), @@ -98,7 +98,7 @@ def strftest(now): except ValueError, error: print "Standard '%s' format gave error:" % e[0], error continue - if result == e[1]: continue + if re.match(e[1], result): continue if result[0] == '%': print "Does not support standard '%s' format (%s)" % (e[0], e[2]) else: @@ -113,7 +113,7 @@ def strftest(now): print "Error for nonstandard '%s' format (%s): %s" % \ (e[0], e[2], str(result)) continue - if result == e[1]: + if re.match(e[1], result): if verbose: print "Supports nonstandard '%s' format (%s)" % (e[0], e[2]) elif result[0] == '%': |