[Python-checkins] python/dist/src/Lib/test test_strptime.py,1.3,1.4
bwarsaw@users.sourceforge.net
bwarsaw@users.sourceforge.net
Thu, 29 Aug 2002 08:25:06 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv15234
Modified Files:
test_strptime.py
Log Message:
The test I saw failing this morning just happened to be run at 8am
localtime, which in -0400 is 12 noon GMT. The bug boiled down to
broken conversion of 12 PM to hour 12 for the '%I %p' format string.
Added a test for this specific condition: Strptime12AMPMTests. Fix to
_strptime.py coming momentarily.
Index: test_strptime.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strptime.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** test_strptime.py 22 Aug 2002 19:57:50 -0000 1.3
--- test_strptime.py 29 Aug 2002 15:25:04 -0000 1.4
***************
*** 265,268 ****
--- 265,279 ----
+ class Strptime12AMPMTests(unittest.TestCase):
+ """Test a _strptime regression in '%I %p' at 12 noon (12 PM)"""
+
+ def test_twelve_noon_midnight(self):
+ eq = self.assertEqual
+ eq(time.strptime('12 PM', '%I %p')[3], 12)
+ eq(time.strptime('12 AM', '%I %p')[3], 0)
+ eq(_strptime.strptime('12 PM', '%I %p')[3], 12)
+ eq(_strptime.strptime('12 AM', '%I %p')[3], 0)
+
+
def test_main():
suite = unittest.TestSuite()
***************
*** 271,274 ****
--- 282,286 ----
suite.addTest(unittest.makeSuite(StrptimeTests))
suite.addTest(unittest.makeSuite(FxnTests))
+ suite.addTest(unittest.makeSuite(Strptime12AMPMTests))
test_support.run_suite(suite)