summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_datetime.py
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2005-01-13 04:12:31 (GMT)
committerSkip Montanaro <skip@pobox.com>2005-01-13 04:12:31 (GMT)
commit0af3ade6aa597a8871dbb62c312a8ab62e3cd309 (patch)
treea7d4665e4c36907f627780ebbd7bff17f2e0b46b /Lib/test/test_datetime.py
parent2f8c6589f5bb1a2e360d040bc38996d95bfca511 (diff)
downloadcpython-0af3ade6aa597a8871dbb62c312a8ab62e3cd309.zip
cpython-0af3ade6aa597a8871dbb62c312a8ab62e3cd309.tar.gz
cpython-0af3ade6aa597a8871dbb62c312a8ab62e3cd309.tar.bz2
Add strptime() constructor to datetime class. Thanks to Josh Spoerri for
the changes.
Diffstat (limited to 'Lib/test/test_datetime.py')
-rw-r--r--Lib/test/test_datetime.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_datetime.py b/Lib/test/test_datetime.py
index ab7bd71..d1f312d 100644
--- a/Lib/test/test_datetime.py
+++ b/Lib/test/test_datetime.py
@@ -1421,6 +1421,15 @@ class TestDateTime(TestDate):
# Else try again a few times.
self.failUnless(abs(from_timestamp - from_now) <= tolerance)
+ def test_strptime(self):
+ import time
+
+ string = '2004-12-01 13:02:47'
+ format = '%Y-%m-%d %H:%M:%S'
+ expected = self.theclass(*(time.strptime(string, format)[0:6]))
+ got = self.theclass.strptime(string, format)
+ self.assertEqual(expected, got)
+
def test_more_timetuple(self):
# This tests fields beyond those tested by the TestDate.test_timetuple.
t = self.theclass(2004, 12, 31, 6, 22, 33)