[Python-checkins] r81390 - python/branches/py3k-cdecimal/Lib/test/decimal_extended_tests/deccheck.py
stefan.krah
python-checkins at python.org
Fri May 21 10:34:08 CEST 2010
Author: stefan.krah
Date: Fri May 21 10:34:08 2010
New Revision: 81390
Log:
1) deccheck.py uses absolute imports.
2) Existing methods of the disagreement-handler object must
be overridden.
3) Fix stale comment.
Modified:
python/branches/py3k-cdecimal/Lib/test/decimal_extended_tests/deccheck.py
Modified: python/branches/py3k-cdecimal/Lib/test/decimal_extended_tests/deccheck.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/decimal_extended_tests/deccheck.py (original)
+++ python/branches/py3k-cdecimal/Lib/test/decimal_extended_tests/deccheck.py Fri May 21 10:34:08 2010
@@ -335,12 +335,16 @@
class dHandlerObj():
"""For non-decimal return values:
- Handle known disagreements between decimal.py and cdecimal.so.
- Currently there are none."""
+ Handle known disagreements between decimal.py and cdecimal.so."""
def __init__(self):
pass
+ def default(self, result, operands):
+ return False
+ __ge__ = __gt__ = __le__ = __lt__ = __repr__ = __str__ = \
+ __ne__ = __eq__ = default
+
if py_minor >= 2:
def __hash__(self, result, operands):
c = operands[0]
@@ -350,12 +354,9 @@
# If a Decimal instance is exactly representable as a float
# then (in 3.2) its hash matches that of the float.
f = float(c.dec)
- if Decimal.from_float(f) == c.dec:
+ if decimal.Decimal.from_float(f) == c.dec:
return True
- def default(self, result, operands):
- return False
-
dhandler_cdec = dHandlerCdec()
def cdec_known_disagreement(result, funcname, operands):
@@ -366,7 +367,6 @@
return getattr(dhandler_obj, funcname, dhandler_obj.default)(result, operands)
-
def verify(result, funcname, operands):
"""Verifies that after operation 'funcname' with operand(s) 'operands'
result[0] and result[1] as well as the context flags have the same
More information about the Python-checkins
mailing list