summaryrefslogtreecommitdiffstats
path: root/Lib/test/datetimetester.py
diff options
context:
space:
mode:
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>2011-05-02 17:14:24 (GMT)
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>2011-05-02 17:14:24 (GMT)
commit89da349b7be56000e4b0efbe11ec4958af691b42 (patch)
tree0f6a529fb790429d25c0eb73c7c66c8836642dc3 /Lib/test/datetimetester.py
parent9d8c3b7cef1f235e92b018924ca21e0d1a49efd7 (diff)
downloadcpython-89da349b7be56000e4b0efbe11ec4958af691b42.zip
cpython-89da349b7be56000e4b0efbe11ec4958af691b42.tar.gz
cpython-89da349b7be56000e4b0efbe11ec4958af691b42.tar.bz2
Issue #11930: Remove year >= 1000 limitation from datetime.strftime.
Patch by Victor Stinner.
Diffstat (limited to 'Lib/test/datetimetester.py')
-rw-r--r--Lib/test/datetimetester.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py
index 38f3b8f..4a62bd4 100644
--- a/Lib/test/datetimetester.py
+++ b/Lib/test/datetimetester.py
@@ -1289,12 +1289,10 @@ class TestDate(HarmlessMixedComparison, unittest.TestCase):
self.assertTrue(self.theclass.min)
self.assertTrue(self.theclass.max)
- def test_strftime_out_of_range(self):
- # For nasty technical reasons, we can't handle years before 1000.
- cls = self.theclass
- self.assertEqual(cls(1000, 1, 1).strftime("%Y"), "1000")
- for y in 1, 49, 51, 99, 100, 999:
- self.assertRaises(ValueError, cls(y, 1, 1).strftime, "%Y")
+ def test_strftime_y2k(self):
+ for y in (1, 49, 70, 99, 100, 999, 1000, 1970):
+ self.assertEqual(self.theclass(y, 1, 1).strftime("%Y"),
+ '%04d' % y)
def test_replace(self):
cls = self.theclass