summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_time.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-07-19 17:04:46 (GMT)
committerGuido van Rossum <guido@python.org>2002-07-19 17:04:46 (GMT)
commit00efe7e7989b1a28e09ca2158f214494d2064c19 (patch)
tree6e644c4a8ca731d17e0b63ac7f42bf0e835f9568 /Lib/test/test_time.py
parent206d8f818ff100caf0f959c746f2eaf6e9bebda0 (diff)
downloadcpython-00efe7e7989b1a28e09ca2158f214494d2064c19.zip
cpython-00efe7e7989b1a28e09ca2158f214494d2064c19.tar.gz
cpython-00efe7e7989b1a28e09ca2158f214494d2064c19.tar.bz2
Pure Python strptime implementation by Brett Cannon. See SF patch 474274.
Also adds tests.
Diffstat (limited to 'Lib/test/test_time.py')
-rw-r--r--Lib/test/test_time.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py
index 1289931..7c6b3ba 100644
--- a/Lib/test/test_time.py
+++ b/Lib/test/test_time.py
@@ -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)