From e7038425b1480abe03fb579384d9667d26191d10 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 18 Aug 1997 15:37:38 +0000 Subject: [PATCH] Tweaks to cope with strftime returning 0 without error for %Z --- Lib/test/test_strftime.py | 2 +- Lib/test/test_time.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_strftime.py b/Lib/test/test_strftime.py index 2596287ce50..25cf935791d 100755 --- a/Lib/test/test_strftime.py +++ b/Lib/test/test_strftime.py @@ -69,7 +69,7 @@ def strftest(now): nonstandard_expectations = ( # These are standard but don't have predictable output ('%c', fixasctime(time.asctime(now)), 'near-asctime() format'), - ('%Z', 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'), diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py index 85ea6ee5927..acc4d4106b8 100644 --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -16,8 +16,11 @@ for directive in ('a', 'A', 'b', 'B', 'c', 'd', 'H', 'I', 'j', 'm', 'M', 'p', 'S', 'U', 'w', 'W', 'x', 'X', 'y', 'Y', 'Z', '%'): - format = '%' + directive - time.strftime(format, tt) + format = ' %' + directive + try: + time.strftime(format, tt) + except ValueError: + print 'conversion specifier:', format, ' failed.' time.timezone time.tzname