summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2006-09-23 19:53:20 (GMT)
committerBrett Cannon <bcannon@gmail.com>2006-09-23 19:53:20 (GMT)
commite042601251e74a1c5bac287c936daa076b1f9a80 (patch)
treef7088aa7803cd45d7050c0ce32793f377507ec2c /Lib/test
parent9356e11223fb05536fd977dac3327ee7f6e388bd (diff)
downloadcpython-e042601251e74a1c5bac287c936daa076b1f9a80.zip
cpython-e042601251e74a1c5bac287c936daa076b1f9a80.tar.gz
cpython-e042601251e74a1c5bac287c936daa076b1f9a80.tar.bz2
Make output on test_strptime() be more verbose in face of failure. This is in
hopes that more information will help debug the failing test on HPPA Ubuntu.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_time.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py
index f4be759..b5155b4 100644
--- a/Lib/test/test_time.py
+++ b/Lib/test/test_time.py
@@ -102,15 +102,19 @@ class TimeTestCase(unittest.TestCase):
self.assertEquals(expected, result)
def test_strptime(self):
+ # Should be able to go round-trip from strftime to strptime without
+ # throwing an exception.
tt = time.gmtime(self.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
+ format = '%' + directive
+ strf_output = time.strftime(format, tt)
try:
- time.strptime(time.strftime(format, tt), format)
+ time.strptime(strf_output, format)
except ValueError:
- self.fail('conversion specifier: %r failed.' % format)
+ self.fail("conversion specifier %r failed with '%s' input." %
+ (format, strf_output))
def test_asctime(self):
time.asctime(time.gmtime(self.t))