diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2002-12-26 16:19:52 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2002-12-26 16:19:52 (GMT) |
commit | 490602d6294052bf3308d9970f74e529d7e6da2b (patch) | |
tree | 9d8eedda0d38b5484fbb7b81e4d95a3122ce56a9 /Lib/test | |
parent | 4c0db788e2500ca2140633d24b0c1c6c6d277a92 (diff) | |
download | cpython-490602d6294052bf3308d9970f74e529d7e6da2b.zip cpython-490602d6294052bf3308d9970f74e529d7e6da2b.tar.gz cpython-490602d6294052bf3308d9970f74e529d7e6da2b.tar.bz2 |
Fix julian day problem with strptime. Note: XXX about using 0, suggestions?
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_strptime.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_strptime.py b/Lib/test/test_strptime.py index a66b54a..83c03b4 100644 --- a/Lib/test/test_strptime.py +++ b/Lib/test/test_strptime.py @@ -379,6 +379,17 @@ class Strptime12AMPMTests(unittest.TestCase): eq(_strptime.strptime('12 AM', '%I %p')[3], 0) +class JulianTests(unittest.TestCase): + """Test a _strptime regression that all julian (1-366) are accepted""" + + def test_all_julian_days(self): + eq = self.assertEqual + # XXX: should 0 be accepted? + for i in range(1, 367): + # use 2004, since it is a leap year, we have 366 days + eq(_strptime.strptime('%d 2004' % i, '%j %Y')[7], i) + + def test_main(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(LocaleTime_Tests)) @@ -386,6 +397,7 @@ def test_main(): suite.addTest(unittest.makeSuite(StrptimeTests)) suite.addTest(unittest.makeSuite(FxnTests)) suite.addTest(unittest.makeSuite(Strptime12AMPMTests)) + suite.addTest(unittest.makeSuite(JulianTests)) test_support.run_suite(suite) |