[Python-checkins] CVS: python/dist/src/Lib/test test_complex.py,1.5,1.6
Neal Norwitz
nnorwitz@users.sourceforge.net
2001年12月28日 17:02:24 -0800
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv26363
Modified Files:
test_complex.py
Log Message:
SF Patch #494873 add tests for complex numbers including calls to int()/long()
Index: test_complex.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_complex.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** test_complex.py 2001年12月13日 19:57:53 1.5
--- test_complex.py 2001年12月29日 01:02:21 1.6
***************
*** 57,60 ****
--- 57,81 ----
complex(random(), random()))
+ for i in range(100):
+ if not complex(random() + 1e-6, random() + 1e-6):
+ raise TestFailed("complex(random(), random()) should be true")
+
+ if complex(0.0, 0.0):
+ raise TestFailed("complex(0.0, 0.0) should be false")
+
+ try:
+ print int(5+3j)
+ except TypeError:
+ pass
+ else:
+ raise TestFailed("int(complex()) didn't raise TypeError")
+
+ try:
+ print float(5+3j)
+ except TypeError:
+ pass
+ else:
+ raise TestFailed("float(complex()) didn't raise TypeError")
+
try:
z = 1.0 / (0+0j)