]> granicus.if.org Git - python/commitdiff
Different operation in verbose mode: show the supported nonstandard
authorGuido van Rossum <guido@python.org>
Wed, 18 Dec 1996 18:03:10 +0000 (18:03 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 18 Dec 1996 18:03:10 +0000 (18:03 +0000)
options.  Also added two: %n and %t (newline and tab character).

Lib/test/test_strftime.py

index ca0e48e397ac9434bf350e7614e90dd52e6b461c..7acc3ef68455c594a69ed1f4e5a14d04999f6eef 100755 (executable)
@@ -80,18 +80,32 @@ nonstandard_expectations = (
     ('%s', '%d' % nowsecs, 'seconds since the Epoch in UCT'),
     ('%3y', '%03d' % (now[0]%100),
      'year without century rendered using fieldwidth'),
+    ('%n', '\n', 'newline character'),
+    ('%t', '\t', 'tab character'),
     )
 
 if verbose:
     print "Strftime test, platform: %s, Python version: %s" % \
          (sys.platform, string.split(sys.version)[0])
-    expectations = expectations + nonstandard_expectations
 
 for e in expectations:
     result = time.strftime(e[0], now)
     if result == e[1]: continue
     if result[0] == '%':
-       print "Does not appear to support '%s' format" % e[0]
+       print "Does not support standard '%s' format (%s)" % (e[0], e[2])
     else:
        print "Conflict for %s (%s):" % (e[0], e[2])
        print "  Expected %s, but got %s" % (e[1], result)
+
+for e in nonstandard_expectations:
+    result = time.strftime(e[0], now)
+    if result == e[1]:
+       if verbose:
+           print "Supports nonstandard '%s' format (%s)" % (e[0], e[2])
+    elif result[0] == '%':
+       if verbose:
+           print "Does not appear to support '%s' format" % e[0]
+    else:
+       if verbose:
+           print "Conflict for %s (%s):" % (e[0], e[2])
+           print "  Expected %s, but got %s" % (e[1], result)