@@ -78,10 +78,41 @@ def init():
7878
7979# list of individual .decTest test ids that correspond to tests that
8080# we're skipping for one reason or another.
81- skipped_test_ids = [
82- 'scbx164' , # skipping apparently implementation-specific scaleb
83- 'scbx165' , # tests, pending clarification of scaleb rules.
84- ]
81+ skipped_test_ids = set ([
82+ # Skip implementation-specific scaleb tests.
83+ 'scbx164' ,
84+ 'scbx165' ,
85+
86+ # For some operations (currently exp, ln, log10, power), the decNumber
87+ # reference implementation imposes additional restrictions on the context
88+ # and operands. These restrictions are not part of the specification;
89+ # however, the effect of these restrictions does show up in some of the
90+ # testcases. We skip testcases that violate these restrictions, since
91+ # Decimal behaves differently from decNumber for these testcases so these
92+ # testcases would otherwise fail.
93+ 'expx901' ,
94+ 'expx902' ,
95+ 'expx903' ,
96+ 'expx905' ,
97+ 'lnx901' ,
98+ 'lnx902' ,
99+ 'lnx903' ,
100+ 'lnx905' ,
101+ 'logx901' ,
102+ 'logx902' ,
103+ 'logx903' ,
104+ 'logx905' ,
105+ 'powx1183' ,
106+ 'powx1184' ,
107+ 'powx4001' ,
108+ 'powx4002' ,
109+ 'powx4003' ,
110+ 'powx4005' ,
111+ 'powx4008' ,
112+ 'powx4010' ,
113+ 'powx4012' ,
114+ 'powx4014' ,
115+ ])
85116
86117# Make sure it actually raises errors when not expected and caught in flags
87118# Slower, since it runs some things several times.
@@ -172,27 +203,6 @@ def Nonfunction(*args):
172203 'same_quantum' ,
173204 )
174205
175- # For some operations (currently exp, ln, log10, power), the decNumber
176- # reference implementation imposes additional restrictions on the
177- # context and operands. These restrictions are not part of the
178- # specification; however, the effect of these restrictions does show
179- # up in some of the testcases. We skip testcases that violate these
180- # restrictions, since Decimal behaves differently from decNumber for
181- # these testcases so these testcases would otherwise fail.
182-
183- decNumberRestricted = ('power' , 'ln' , 'log10' , 'exp' )
184- DEC_MAX_MATH = 999999
185- def outside_decNumber_bounds (v , context ):
186- if (context .prec > DEC_MAX_MATH or
187- context .Emax > DEC_MAX_MATH or
188- - context .Emin > DEC_MAX_MATH ):
189- return True
190- if not v ._is_special and v and (
191- v .adjusted () > DEC_MAX_MATH or
192- v .adjusted () < 1 - 2 * DEC_MAX_MATH ):
193- return True
194- return False
195-
196206class DecimalTest (unittest .TestCase ):
197207 """Class which tests the Decimal class against the test cases.
198208
@@ -330,22 +340,6 @@ def FixQuotes(val):
330340
331341 ans = FixQuotes (ans )
332342
333- # skip tests that are related to bounds imposed in the decNumber
334- # reference implementation
335- if fname in decNumberRestricted :
336- if fname == 'power' :
337- if not (vals [1 ]._isinteger () and
338- - 1999999997 <= vals [1 ] <= 999999999 ):
339- if outside_decNumber_bounds (vals [0 ], self .context ) or \
340- outside_decNumber_bounds (vals [1 ], self .context ):
341- #print "Skipping test %s" % s
342- return
343- else :
344- if outside_decNumber_bounds (vals [0 ], self .context ):
345- #print "Skipping test %s" % s
346- return
347-
348-
349343 if EXTENDEDERRORTEST and fname not in ('to_sci_string' , 'to_eng_string' ):
350344 for error in theirexceptions :
351345 self .context .traps [error ] = 1
0 commit comments