MCPcopy Index your code
hub / github.com/python/cpython / TestSet

Class TestSet

Modules/_decimal/tests/deccheck.py:341–380  ·  view source on GitHub ↗

A TestSet contains the original input operands, converted operands, Python exceptions that occurred either during conversion or during execution of the actual function, and the final results. For safety, most attributes are lists that only support the append operation.

Source from the content-addressed store, hash-verified

339 __mul__ = __reversed__ = __rmul__ = __setattr__ = __setitem__ = unsupported
340
341class TestSet(object):
342 """A TestSet contains the original input operands, converted operands,
343 Python exceptions that occurred either during conversion or during
344 execution of the actual function, and the final results.
345
346 For safety, most attributes are lists that only support the append
347 operation.
348
349 If a function name is prefixed with 'context.', the corresponding
350 context method is called.
351 """
352 def __init__(self, funcname, operands):
353 if funcname.startswith("context."):
354 self.funcname = funcname.replace("context.", "")
355 self.contextfunc = True
356 else:
357 self.funcname = funcname
358 self.contextfunc = False
359 self.op = operands # raw operand tuple
360 self.context = context # context used for the operation
361 self.cop = RestrictedList() # converted C.Decimal operands
362 self.cex = RestrictedList() # Python exceptions for C.Decimal
363 self.cresults = RestrictedList() # C.Decimal results
364 self.pop = RestrictedList() # converted P.Decimal operands
365 self.pex = RestrictedList() # Python exceptions for P.Decimal
366 self.presults = RestrictedList() # P.Decimal results
367
368 # If the above results are exact, unrounded and not clamped, repeat
369 # the operation with a maxcontext to ensure that huge intermediate
370 # values do not cause a MemoryError.
371 self.with_maxcontext = False
372 self.maxcontext = context.c.copy()
373 self.maxcontext.prec = C.MAX_PREC
374 self.maxcontext.Emax = C.MAX_EMAX
375 self.maxcontext.Emin = C.MIN_EMIN
376 self.maxcontext.clear_flags()
377
378 self.maxop = RestrictedList() # converted C.Decimal operands
379 self.maxex = RestrictedList() # Python exceptions for C.Decimal
380 self.maxresults = RestrictedList() # C.Decimal results
381
382
383# ======================================================================

Callers 7

test_unaryFunction · 0.70
test_binaryFunction · 0.70
test_ternaryFunction · 0.70
test_formatFunction · 0.70
test_roundFunction · 0.70
test_from_floatFunction · 0.70
test_quantize_apiFunction · 0.70

Calls

no outgoing calls

Tested by 7

test_unaryFunction · 0.56
test_binaryFunction · 0.56
test_ternaryFunction · 0.56
test_formatFunction · 0.56
test_roundFunction · 0.56
test_from_floatFunction · 0.56
test_quantize_apiFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…