]> granicus.if.org Git - python/commitdiff
Tweaks to cope with strftime returning 0 without error for %Z
authorGuido van Rossum <guido@python.org>
Mon, 18 Aug 1997 15:37:38 +0000 (15:37 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 18 Aug 1997 15:37:38 +0000 (15:37 +0000)
Lib/test/test_strftime.py
Lib/test/test_time.py

index 2596287ce509c16eab6d8add39dbfa413e4b66dd..25cf935791d956b4e9d138e36b88230975ad35cb 100755 (executable)
@@ -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'),
index 85ea6ee592744397b301e11c036bdcea7211209b..acc4d4106b8a99173084f348a24c574b2e194b3c 100644 (file)
@@ -16,8 +16,11 @@ tt = time.gmtime(t)
 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