[Python-checkins] python/nondist/sandbox/datetime datetime.py,1.93,1.94 test_both.py,1.64,1.65

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
2002年12月11日 18:58:45 -0800


Update of /cvsroot/python/python/nondist/sandbox/datetime
In directory sc8-pr-cvs1:/tmp/cvs-serv8047
Modified Files:
	datetime.py test_both.py 
Log Message:
Beefed up the timetz tests a little more.
Index: datetime.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.py,v
retrieving revision 1.93
retrieving revision 1.94
diff -C2 -d -r1.93 -r1.94
*** datetime.py	11 Dec 2002 21:47:38 -0000	1.93
--- datetime.py	12 Dec 2002 02:58:42 -0000	1.94
***************
*** 934,938 ****
 return supercmp(other)
 if myoff is None or otoff is None:
! raise ValueError, "cannot mix naive and timezone-aware time"
 myhhmm = self.hour * 60 + self.minute - myoff
 othhmm = other.hour * 60 + other.minute - otoff
--- 934,938 ----
 return supercmp(other)
 if myoff is None or otoff is None:
! raise TypeError, "cannot mix naive and timezone-aware time"
 myhhmm = self.hour * 60 + self.minute - myoff
 othhmm = other.hour * 60 + other.minute - otoff
Index: test_both.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_both.py,v
retrieving revision 1.64
retrieving revision 1.65
diff -C2 -d -r1.64 -r1.65
*** test_both.py	12 Dec 2002 02:55:16 -0000	1.64
--- test_both.py	12 Dec 2002 02:58:43 -0000	1.65
***************
*** 1518,1521 ****
--- 1518,1524 ----
 self.assertEqual(t1, t3)
 self.assertEqual(t2, t3)
+ self.assertRaises(TypeError, lambda: t4 == t5) # mixed tz-aware & naive
+ self.assertRaises(TypeError, lambda: t4 < t5) # mixed tz-aware & naive
+ self.assertRaises(TypeError, lambda: t5 < t4) # mixed tz-aware & naive
 
 self.assertEqual(str(t1), "07:47:00-05:00")

AltStyle によって変換されたページ (->オリジナル) /