[Zope3-checkins] CVS: Zope3/lib/python/datetime/tests - test_datetime.py:1.6
Tim Peters
tim.one@comcast.net
Sun, 22 Dec 2002 15:45:26 -0500
Update of /cvs-repository/Zope3/lib/python/datetime/tests
In directory cvs.zope.org:/tmp/cvs-serv3035/lib/python/datetime/tests
Modified Files:
test_datetime.py
Log Message:
I give up: unless I write my own strftime by hand, datetime just can't
be trusted with years before 1900, so now we raise ValueError if a date or
datetime or datetimetz .strftime() method is called with a year before
1900.
=== Zope3/lib/python/datetime/tests/test_datetime.py 1.5 => 1.6 ===
--- Zope3/lib/python/datetime/tests/test_datetime.py:1.5 Sat Dec 21 21:02:21 2002
+++ Zope3/lib/python/datetime/tests/test_datetime.py Sun Dec 22 15:45:25 2002
@@ -874,6 +874,12 @@
self.failUnless(self.theclass.min)
self.failUnless(self.theclass.max)
+ def test_srftime_out_of_range(self):
+ # For nasty technical reasons, we can't handle years before 1900.
+ cls = self.theclass
+ self.assertEqual(cls(1900, 1, 1).strftime("%Y"), "1900")
+ for y in 1, 49, 51, 99, 100, 1000, 1899:
+ self.assertRaises(ValueError, cls(y, 1, 1).strftime, "%Y")
#############################################################################
# datetime tests