[Python-checkins] python/dist/src/Lib/test test_datetime.py, 1.49, 1.50

montanaro at users.sourceforge.net montanaro at users.sourceforge.net
Thu Jan 13 05:13:00 CET 2005


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27707/Lib/test
Modified Files:
	test_datetime.py 
Log Message:
Add strptime() constructor to datetime class. Thanks to Josh Spoerri for
the changes.
Index: test_datetime.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_datetime.py,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- test_datetime.py	16 Sep 2004 01:30:47 -0000	1.49
+++ test_datetime.py	13 Jan 2005 04:12:27 -0000	1.50
@@ -1421,6 +1421,15 @@
 # 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)


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /