[Python-checkins] CVS: python/dist/src/Lib/test test_complex.py,1.1,1.2
Tim Peters
tim_one@users.sourceforge.net
Tue, 29 May 2001 15:18:11 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv11489/python/dist/src/Lib/test
Modified Files:
test_complex.py
Log Message:
This division test was too stringent in its accuracy expectations for
random inputs: if you ran the test 100 times, you could expect it to
report a bogus failure. So loosened its expectations.
Also changed the way failing tests are printed, so that when run under
regrtest.py we get enough info to reproduce the failure.
Index: test_complex.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_complex.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** test_complex.py 2001/03/18 08:21:56 1.1
--- test_complex.py 2001/05/29 22:18:09 1.2
***************
*** 6,10 ****
nerrors = 0
! def check_close_real(x, y, eps=1e-12):
"""Return true iff floats x and y "are close\""""
# put the one with larger magnitude second
--- 6,10 ----
nerrors = 0
! def check_close_real(x, y, eps=1e-9):
"""Return true iff floats x and y "are close\""""
# put the one with larger magnitude second
***************
*** 18,22 ****
return abs((x-y)/y) < eps
! def check_close(x, y, eps=1e-12):
"""Return true iff complexes x and y "are close\""""
return check_close_real(x.real, y.real, eps) and \
--- 18,22 ----
return abs((x-y)/y) < eps
! def check_close(x, y, eps=1e-9):
"""Return true iff complexes x and y "are close\""""
return check_close_real(x.real, y.real, eps) and \
***************
*** 31,40 ****
if not check_close(q, y):
nerrors += 1
! print `z`, "/", `x`, "==", `q`, "but expected", `y`
if y != 0:
q = z / y
if not check_close(q, x):
nerrors += 1
! print `z`, "/", `y`, "==", `q`, "but expected", `x`
simple_real = [float(i) for i in range(-5, 6)]
--- 31,40 ----
if not check_close(q, y):
nerrors += 1
! print "%r / %r == %r but expected %r" % (z, x, q, y)
if y != 0:
q = z / y
if not check_close(q, x):
nerrors += 1
! print "%r / %r == %r but expected %r" % (z, y, q, x)
simple_real = [float(i) for i in range(-5, 6)]