[Python-checkins] r87635 - python/branches/py3k-cdecimal/Lib/test/mpdecimal/python/ctx-deccheck.py
stefan.krah
python-checkins at python.org
Sun Jan 2 18:02:03 CET 2011
Author: stefan.krah
Date: Sun Jan 2 18:02:02 2011
New Revision: 87635
Log:
Add meaningful exit status.
Modified:
python/branches/py3k-cdecimal/Lib/test/mpdecimal/python/ctx-deccheck.py
Modified: python/branches/py3k-cdecimal/Lib/test/mpdecimal/python/ctx-deccheck.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/mpdecimal/python/ctx-deccheck.py (original)
+++ python/branches/py3k-cdecimal/Lib/test/mpdecimal/python/ctx-deccheck.py Sun Jan 2 18:02:02 2011
@@ -36,6 +36,7 @@
from randdec import *
+EXIT_STATUS = 0
py_minor = sys.version_info[1]
py_micro = sys.version_info[2]
@@ -377,7 +378,6 @@
return self.un_resolve_ulp(result, "ln", operands)
def __pow__(self, result, operands):
- """See DIFFERENCES.txt"""
if operands[2] is not None: # three argument __pow__
# issue7049: third arg must fit into precision
if (operands[0].mpd.is_zero() != operands[1].mpd.is_zero()):
@@ -395,6 +395,7 @@
context.f.flags[cdecimal.Inexact] and \
context.d.flags[decimal.Rounded] and \
context.d.flags[decimal.Inexact]:
+ # decimal.py: correctly-rounded pow()
return self.bin_resolve_ulp(result, "__pow__", operands)
else:
return False
@@ -460,9 +461,11 @@
"""Verifies that after operation 'funcname' with operand(s) 'operands'
result[0] and result[1] as well as the context flags have the same
values."""
+ global EXIT_STATUS
if result[0] != result[1] or not context.assert_eq_status():
if obj_known_disagreement(result, funcname, operands):
return # skip known disagreements
+ EXIT_STATUS = 1
raise CdecException(result, funcname, operands,
str(context.f), str(context.d))
@@ -494,6 +497,7 @@
"""Verifies that after operation 'funcname' with operand(s) 'operands'
self.mpd and self.dec as well as the context flags have the same
values."""
+ global EXIT_STATUS
mpdstr = str(self.mpd)
decstr = str(self.dec)
mpdstr_eng = self.mpd.to_eng_string()
@@ -502,6 +506,7 @@
not context.assert_eq_status():
if cdec_known_disagreement(self, funcname, operands):
return # skip known disagreements
+ EXIT_STATUS = 1
raise CdecException(self, funcname, operands,
str(context.f), str(context.d))
@@ -1065,3 +1070,6 @@
prec_lst = sorted(random.sample(range(1, 101), samples))
test_from_float(prec_lst)
+
+
+ sys.exit(EXIT_STATUS)
More information about the Python-checkins
mailing list