summaryrefslogtreecommitdiffstats
path: root/Lib/test/support.py
diff options
context:
space:
mode:
authorEli Bendersky <eliben@gmail.com>2011-02-25 10:14:17 (GMT)
committerEli Bendersky <eliben@gmail.com>2011-02-25 10:14:17 (GMT)
commit67ebabd1527d7b461ed6a4e853e100a19751368b (patch)
tree6e8f86933518d68ea83dda12caf22857df4b3dc3 /Lib/test/support.py
parentcbbaa96036b8467c21f2c7127a3711fcb405d00f (diff)
downloadcpython-67ebabd1527d7b461ed6a4e853e100a19751368b.zip
cpython-67ebabd1527d7b461ed6a4e853e100a19751368b.tar.gz
cpython-67ebabd1527d7b461ed6a4e853e100a19751368b.tar.bz2
Removed fcmp and FUZZ from test.support, following the discussion on python-dev:
http://mail.python.org/pipermail/python-dev/2011-January/107735.html
Diffstat (limited to 'Lib/test/support.py')
-rw-r--r--Lib/test/support.py20
1 files changed, 1 insertions, 19 deletions
diff --git a/Lib/test/support.py b/Lib/test/support.py
index 63c5569..7e544fc 100644
--- a/Lib/test/support.py
+++ b/Lib/test/support.py
@@ -33,7 +33,7 @@ __all__ = [
"verbose", "use_resources", "max_memuse", "record_original_stdout",
"get_original_stdout", "unload", "unlink", "rmtree", "forget",
"is_resource_enabled", "requires", "find_unused_port", "bind_port",
- "fcmp", "is_jython", "TESTFN", "HOST", "FUZZ", "SAVEDCWD", "temp_cwd",
+ "is_jython", "TESTFN", "HOST", "SAVEDCWD", "temp_cwd",
"findfile", "sortdict", "check_syntax_error", "open_urlresource",
"check_warnings", "CleanImport", "EnvironmentVarGuard",
"TransientResource", "captured_output", "captured_stdout",
@@ -349,24 +349,6 @@ def bind_port(sock, host=HOST):
port = sock.getsockname()[1]
return port
-FUZZ = 1e-6
-
-def fcmp(x, y): # fuzzy comparison function
- if isinstance(x, float) or isinstance(y, float):
- try:
- fuzz = (abs(x) + abs(y)) * FUZZ
- if abs(x-y) <= fuzz:
- return 0
- except:
- pass
- elif type(x) == type(y) and isinstance(x, (tuple, list)):
- for i in range(min(len(x), len(y))):
- outcome = fcmp(x[i], y[i])
- if outcome != 0:
- return outcome
- return (len(x) > len(y)) - (len(x) < len(y))
- return (x > y) - (x < y)
-
# decorator for skipping tests on non-IEEE 754 platforms
requires_IEEE_754 = unittest.skipUnless(
float.__getformat__("double").startswith("IEEE"),