[Python-checkins] python/nondist/sandbox/datetime test_both.py,1.30,1.31
tim_one@users.sourceforge.net
tim_one@users.sourceforge.net
2002年12月03日 15:07:30 -0800
Update of /cvsroot/python/python/nondist/sandbox/datetime
In directory sc8-pr-cvs1:/tmp/cvs-serv25519
Modified Files:
test_both.py
Log Message:
Added tests to confirm claims in the docs:
int // timedelta not supported
timedelta // int raises ZeroDivisionError
Index: test_both.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_both.py,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** test_both.py 3 Dec 2002 21:54:36 -0000 1.30
--- test_both.py 3 Dec 2002 23:07:28 -0000 1.31
***************
*** 124,127 ****
--- 124,133 ----
self.assertRaises(TypeError, lambda: x // a)
+ # Divison of int by timedelta doesn't make sense.
+ # Division by zero doesn't make sense.
+ for zero in 0, 0L:
+ self.assertRaises(TypeError, lambda: zero // a)
+ self.assertRaises(ZeroDivisionError, lambda: a // zero)
+
def test_basic_attributes(self):
days, seconds, us = 1, 7, 31