Kaydet (Commit) 00efe7e7 authored tarafından Guido van Rossum's avatar Guido van Rossum

Pure Python strptime implementation by Brett Cannon. See SF patch 474274.

Also adds tests.
üst 206d8f81
This diff is collapsed.
This diff is collapsed.
......@@ -37,6 +37,18 @@ class TimeTestCase(unittest.TestCase):
except ValueError:
self.fail('conversion specifier: %r failed.' % format)
def test_strptime(self):
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
try:
time.strptime(time.strftime(format, tt), format)
except ValueError:
self.fail('conversion specifier: %r failed.' % format)
def test_asctime(self):
time.asctime(time.gmtime(self.t))
self.assertRaises(TypeError, time.asctime, 0)
......
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