Kaydet (Commit) e0426012 authored tarafından Brett Cannon's avatar Brett Cannon

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.
üst 9356e112
...@@ -102,15 +102,19 @@ class TimeTestCase(unittest.TestCase): ...@@ -102,15 +102,19 @@ class TimeTestCase(unittest.TestCase):
self.assertEquals(expected, result) self.assertEquals(expected, result)
def test_strptime(self): def test_strptime(self):
# Should be able to go round-trip from strftime to strptime without
# throwing an exception.
tt = time.gmtime(self.t) tt = time.gmtime(self.t)
for directive in ('a', 'A', 'b', 'B', 'c', 'd', 'H', 'I', for directive in ('a', 'A', 'b', 'B', 'c', 'd', 'H', 'I',
'j', 'm', 'M', 'p', 'S', 'j', 'm', 'M', 'p', 'S',
'U', 'w', 'W', 'x', 'X', 'y', 'Y', 'Z', '%'): 'U', 'w', 'W', 'x', 'X', 'y', 'Y', 'Z', '%'):
format = ' %' + directive format = '%' + directive
strf_output = time.strftime(format, tt)
try: try:
time.strptime(time.strftime(format, tt), format) time.strptime(strf_output, format)
except ValueError: 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): def test_asctime(self):
time.asctime(time.gmtime(self.t)) time.asctime(time.gmtime(self.t))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment