summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_strftime.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-12-18 18:03:10 (GMT)
committerGuido van Rossum <guido@python.org>1996-12-18 18:03:10 (GMT)
commit5eaf4578699a6e1d8c677a17e44cba64cd022cdf (patch)
tree856cda00349009da3a8c0618be46bd900a516cf9 /Lib/test/test_strftime.py
parentaf82a7ef4940c8f1df6c935826b03c34bcf05bc5 (diff)
downloadcpython-5eaf4578699a6e1d8c677a17e44cba64cd022cdf.zip
cpython-5eaf4578699a6e1d8c677a17e44cba64cd022cdf.tar.gz
cpython-5eaf4578699a6e1d8c677a17e44cba64cd022cdf.tar.bz2
Different operation in verbose mode: show the supported nonstandard
options. Also added two: %n and %t (newline and tab character).
Diffstat (limited to 'Lib/test/test_strftime.py')
-rwxr-xr-xLib/test/test_strftime.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/Lib/test/test_strftime.py b/Lib/test/test_strftime.py
index ca0e48e..7acc3ef 100755
--- a/Lib/test/test_strftime.py
+++ b/Lib/test/test_strftime.py
@@ -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)