[Zope-Checkins] CVS: Zope/lib/python/DateTime/tests - testDateTime.py:1.4.24.1
Shane Hathaway
shane@digicool.com
Mon, 3 Dec 2001 15:15:51 -0500
Update of /cvs-repository/Zope/lib/python/DateTime/tests
In directory cvs.zope.org:/tmp/cvs-serv27426/tests
Modified Files:
Tag: Zope-2_5-branch
testDateTime.py
Log Message:
Merge from trunk.
=== Zope/lib/python/DateTime/tests/testDateTime.py 1.4 => 1.4.24.1 ===
assert dt1 - dt == 1.0, (dt, dt1)
+ def testCompareMethods(self):
+ '''Compare two dates using several methods'''
+ dt = DateTime('1997/1/1')
+ dt1 = DateTime('1997/2/2')
+ self.failUnless(dt1.greaterThan(dt))
+ self.failUnless(dt1.greaterThanEqualTo(dt))
+ self.failUnless(dt.lessThan(dt1))
+ self.failUnless(dt.lessThanEqualTo(dt1))
+ self.failUnless(dt.notEqualTo(dt1))
+ self.failUnless(not dt.equalTo(dt1))
+
+ def testCompareOperations(self, dt=None, dt1=None):
+ """Compare two dates using several operations"""
+ if dt is None:
+ dt = DateTime('1997/1/1')
+ if dt1 is None:
+ dt1 = DateTime('1997/2/2')
+ self.failUnless(dt1 > dt)
+ self.failUnless(dt1 >= dt)
+ self.failUnless(dt < dt1)
+ self.failUnless(dt <= dt1)
+ self.failUnless(dt != dt1)
+ self.failUnless(not (dt == dt1))
+
+ def testUpgradeOldInstances(self):
+ """Compare dates that don't have the _millis attribute yet."""
+ dt = DateTime('1997/1/1')
+ dt1 = DateTime('1997/2/2')
+ del dt._millis
+ del dt1._millis
+ self.testCompareOperations(dt, dt1)
+
def testTZ2(self):
'''Time zone manipulation test 2'''
dt = DateTime()