[Python-checkins] python/nondist/sandbox/decimal test_Decimal.py,1.1,1.2
eprice@users.sourceforge.net
eprice@users.sourceforge.net
Wed, 02 Jul 2003 16:50:03 -0700
- Previous message: [Python-checkins] python/nondist/sandbox/decimal Decimal.py,1.9,1.10
- Next message: [Python-checkins] python/nondist/sandbox/decimal/tests quantize.decTest,NONE,1.1 abs.decTest,1.2,1.3 add.decTest,1.2,1.3 base.decTest,1.2,1.3 clamp.decTest,1.2,1.3 compare.decTest,1.2,1.3 decimal64.decTest,1.2,1.3 divide.decTest,1.2,1.3 divideint.decTest,1.2,1.3 inexact.decTest,1.2,1.3 integer.decTest,1.2,1.3 max.decTest,1.2,1.3 min.decTest,1.2,1.3 minus.decTest,1.2,1.3 multiply.decTest,1.2,1.3 normalize.decTest,1.2,1.3 plus.decTest,1.2,1.3 power.decTest,1.2,1.3 randomBound32.decTest,1.2,1.3 randoms.decTest,1.2,1.3 remainder.decTest,1.2,1.3 remainderNear.decTest,1.2,1.3 rescale.decTest,1.2,1.3 rounding.decTest,1.2,1.3 squareroot.decTest,1.2,1.3 subtract.decTest,1.2,1.3 testall.decTest,1.2,1.3 trim.decTest,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/nondist/sandbox/decimal
In directory sc8-pr-cvs1:/tmp/cvs-serv994
Modified Files:
test_Decimal.py
Log Message:
Changed rescale test cases to the new quantize one.
Moved in a list that had been in the main class.
Index: test_Decimal.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/decimal/test_Decimal.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_Decimal.py 21 May 2003 16:20:24 -0000 1.1
--- test_Decimal.py 2 Jul 2003 23:50:01 -0000 1.2
***************
*** 12,15 ****
--- 12,35 ----
skip_expected = not os.path.isdir(dir)
+
+ #Map the test cases' error names to the actual errors
+
+ ErrorNames = {'clamped' : Clamped,
+ 'conversion_syntax' : ConversionSyntax,
+ 'division_by_zero' : DivisionByZero,
+ 'division_impossible' : DivisionImpossible,
+ 'division_undefined' : DivisionUndefined,
+ 'inexact' : Inexact,
+ 'insufficient_storage' : InsufficientStorage,
+ 'invalid_context' : InvalidContext,
+ 'invalid_operation' : InvalidOperation,
+ 'lost_digits' : LostDigits,
+ 'overflow' : Overflow,
+ 'rounded' : Rounded,
+ 'subnormal' : Subnormal,
+ 'underflow' : Underflow}
+
+
+
def Nonfunction(*args):
"""Doesn't do anything."""
***************
*** 102,106 ****
id = L[0]
#print id,
! funct = L[1]
valstemp = L[2:]
L = Sides[1].strip().split()
--- 122,126 ----
id = L[0]
#print id,
! funct = L[1].lower()
valstemp = L[2:]
L = Sides[1].strip().split()
***************
*** 116,119 ****
--- 136,141 ----
fname = funct
funct = getattr(self.context, funct)
+ if fname == 'rescale':
+ return
vals = []
conglomerate = ''
***************
*** 125,129 ****
for exception in theirexceptions:
self.context.trap_enablers[exception] = 0
! for val in valstemp:
if val.count("'") % 2 == 1:
quote = 1 - quote
--- 147,151 ----
for exception in theirexceptions:
self.context.trap_enablers[exception] = 0
! for i, val in enumerate(valstemp):
if val.count("'") % 2 == 1:
quote = 1 - quote
***************
*** 135,140 ****
conglomerate = ''
v = FixQuotes(val)
! if fname in ('toSci', 'toEng'):
v = self.context.new(v)
else:
v = Decimal(v)
--- 157,167 ----
conglomerate = ''
v = FixQuotes(val)
! if fname in ('tosci', 'toeng'):
v = self.context.new(v)
+ #elif fname == 'rescale' and i == 1:
+ # try:
+ # v = int(Decimal(v))
+ # except ValueError:
+ # v = float(v)
else:
v = Decimal(v)
***************
*** 145,150 ****
try:
result = str(funct(*vals))
except: #Catch any error long enough to state the test case.
! #print "ERROR:", s
raise
--- 172,179 ----
try:
result = str(funct(*vals))
+ except ExceptionList, error:
+ self.fail("Raised %s in %s" % (error, s))
except: #Catch any error long enough to state the test case.
! print "ERROR:", s
raise
***************
*** 295,298 ****
--- 324,334 ----
self.eval_file(dir + 'power' + '.decTest')
+ def test_quantize(self):
+ """Tests the Decimal class on Cowlishaw's quantize tests.
+
+ See www2.hursley.ibm.com/decimal/decTest.zip to download the suite.
+ """
+ self.eval_file(dir + 'quantize' + '.decTest')
+
def test_randomBound32(self):
"""Tests the Decimal class on Cowlishaw's randomBound32 tests.
***************
*** 322,332 ****
"""
self.eval_file(dir + 'remainderNear' + '.decTest')
-
- def test_rescale(self):
- """Tests the Decimal class on Cowlishaw's rescale tests.
-
- See www2.hursley.ibm.com/decimal/decTest.zip to download the suite.
- """
- self.eval_file(dir + 'rescale' + '.decTest')
def test_rounding(self):
--- 358,361 ----
- Previous message: [Python-checkins] python/nondist/sandbox/decimal Decimal.py,1.9,1.10
- Next message: [Python-checkins] python/nondist/sandbox/decimal/tests quantize.decTest,NONE,1.1 abs.decTest,1.2,1.3 add.decTest,1.2,1.3 base.decTest,1.2,1.3 clamp.decTest,1.2,1.3 compare.decTest,1.2,1.3 decimal64.decTest,1.2,1.3 divide.decTest,1.2,1.3 divideint.decTest,1.2,1.3 inexact.decTest,1.2,1.3 integer.decTest,1.2,1.3 max.decTest,1.2,1.3 min.decTest,1.2,1.3 minus.decTest,1.2,1.3 multiply.decTest,1.2,1.3 normalize.decTest,1.2,1.3 plus.decTest,1.2,1.3 power.decTest,1.2,1.3 randomBound32.decTest,1.2,1.3 randoms.decTest,1.2,1.3 remainder.decTest,1.2,1.3 remainderNear.decTest,1.2,1.3 rescale.decTest,1.2,1.3 rounding.decTest,1.2,1.3 squareroot.decTest,1.2,1.3 subtract.decTest,1.2,1.3 testall.decTest,1.2,1.3 trim.decTest,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]