[Zope3-checkins] CVS: ZODB4/ZODB/tests - testTimeStamp.py:1.5
Jeremy Hylton
jeremy@zope.com
Thu, 5 Dec 2002 19:01:29 -0500
Update of /cvs-repository/ZODB4/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv6359
Modified Files:
testTimeStamp.py
Log Message:
Add a test from ZODB3.
=== ZODB4/ZODB/tests/testTimeStamp.py 1.4 => 1.5 ===
--- ZODB4/ZODB/tests/testTimeStamp.py:1.4 Mon Jun 10 19:27:45 2002
+++ ZODB4/ZODB/tests/testTimeStamp.py Thu Dec 5 19:01:29 2002
@@ -95,5 +95,40 @@
# XXX should test for bogus inputs to TimeStamp constructor
+ def checkTimeStamp(self):
+ # Alternate test suite
+ t = TimeStamp(2002, 1, 23, 10, 48, 5) # GMT
+ self.assertEquals(str(t), '2002-01-23 10:48:05.000000')
+ self.assertEquals(repr(t), '\x03B9H\x15UUU')
+ self.assertEquals(TimeStamp('\x03B9H\x15UUU'), t)
+ self.assertEquals(t.year(), 2002)
+ self.assertEquals(t.month(), 1)
+ self.assertEquals(t.day(), 23)
+ self.assertEquals(t.hour(), 10)
+ self.assertEquals(t.minute(), 48)
+ self.assertEquals(round(t.second()), 5)
+ self.assertEquals(t.second(), t.seconds()) # Alias
+ self.assertEquals(t.timeTime(), 1011782885)
+ t1 = TimeStamp(2002, 1, 23, 10, 48, 10)
+ self.assertEquals(str(t1), '2002-01-23 10:48:10.000000')
+ self.assert_(t == t)
+ self.assert_(t != t1)
+ self.assert_(t < t1)
+ self.assert_(t <= t1)
+ self.assert_(t1 >= t)
+ self.assert_(t1 > t)
+ self.failIf(t == t1)
+ self.failIf(t != t)
+ self.failIf(t > t1)
+ self.failIf(t >= t1)
+ self.failIf(t1 < t)
+ self.failIf(t1 <= t)
+ self.assertEquals(cmp(t, t), 0)
+ self.assertEquals(cmp(t, t1), -1)
+ self.assertEquals(cmp(t1, t), 1)
+ self.assertEquals(t1.laterThan(t), t1)
+ self.assert_(t.laterThan(t1) > t1)
+ self.assertEquals(TimeStamp(2002,1,23), TimeStamp(2002,1,23,0,0,0))
+
def test_suite():
return unittest.makeSuite(TimeStampTests, 'check')