diff options
author | Guido van Rossum <guido@python.org> | 1997-11-24 22:24:22 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-11-24 22:24:22 (GMT) |
commit | e2d4dd194b67800f67c5b333fc3d891eeed09d09 (patch) | |
tree | 642d3fd5a55e796050cbd0fcd8d3c760546c48eb | |
parent | 275feea40fc1eaad7e6f16a28f5d6f037d364503 (diff) | |
download | cpython-e2d4dd194b67800f67c5b333fc3d891eeed09d09.zip cpython-e2d4dd194b67800f67c5b333fc3d891eeed09d09.tar.gz cpython-e2d4dd194b67800f67c5b333fc3d891eeed09d09.tar.bz2 |
Use fuzzy comparison from test_support to compare outcome of
pow(x,y,z) to pow(x,y)%z.
-rw-r--r-- | Lib/test/test_pow.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/test/test_pow.py b/Lib/test/test_pow.py index 03f7314..fc67253 100644 --- a/Lib/test/test_pow.py +++ b/Lib/test/test_pow.py @@ -1,4 +1,5 @@ import sys +import test_support def powtest(type): if (type!=float): @@ -27,8 +28,10 @@ def powtest(type): il, ih = -20, 20 jl, jh = -5, 5 kl, kh = -10, 10 + compare = cmp if (type==float): il=1 + compare = test_support.fcmp elif (type==int): jl=0 elif (type==long): @@ -37,7 +40,7 @@ def powtest(type): for j in range(jl,jh+1): for k in range(kl, kh+1): if (k!=0): - if (pow(type(i),j,k)!=pow(type(i),j)% type(k) ): + if compare(pow(type(i),j,k), pow(type(i),j)% type(k)): raise ValueError, "pow(" +str(i)+ "," +str(j)+ \ "," +str(k)+ ") != pow(" +str(i)+ "," + \ str(j)+ ") % " +str(k) |