mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Pure Python strptime implementation by Brett Cannon. See SF patch 474274.
Also adds tests.
This commit is contained in:
parent
206d8f818f
commit
00efe7e798
3 changed files with 779 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue