summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2002-08-29 15:25:04 (GMT)
committerBarry Warsaw <barry@python.org>2002-08-29 15:25:04 (GMT)
commit375e0eeacc23394dfe5f21970070ea50ded1160b (patch)
tree62654fc6feb66f0351b4bee606b4edc87545f43b /Lib/test
parent1a8d19312107e83fff0dd141a432c5e5c9e7504a (diff)
downloadcpython-375e0eeacc23394dfe5f21970070ea50ded1160b.zip
cpython-375e0eeacc23394dfe5f21970070ea50ded1160b.tar.gz
cpython-375e0eeacc23394dfe5f21970070ea50ded1160b.tar.bz2
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.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_strptime.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_strptime.py b/Lib/test/test_strptime.py
index 03b7f97..94a003d 100644
--- a/Lib/test/test_strptime.py
+++ b/Lib/test/test_strptime.py
@@ -264,12 +264,24 @@ class FxnTests(unittest.TestCase):
self.failUnless(strp_output[6] == self.time_tuple[6], "triggering of dayofweek() failed; %s != %s" % (strp_output[6], self.time_tuple[6]))
+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()
suite.addTest(unittest.makeSuite(LocaleTime_Tests))
suite.addTest(unittest.makeSuite(TimeRETests))
suite.addTest(unittest.makeSuite(StrptimeTests))
suite.addTest(unittest.makeSuite(FxnTests))
+ suite.addTest(unittest.makeSuite(Strptime12AMPMTests))
test_support.run_suite(suite)