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

Function randcontext

Modules/_decimal/tests/deccheck.py:1097–1105  ·  view source on GitHub ↗
(exprange)

Source from the content-addressed store, hash-verified

1095 log(err)
1096
1097def randcontext(exprange):
1098 c = Context(C.Context(), P.Context())
1099 c.Emax = random.randrange(1, exprange+1)
1100 c.Emin = random.randrange(-exprange, 0)
1101 maxprec = 100 if c.Emax >= 100 else c.Emax
1102 c.prec = random.randrange(1, maxprec+1)
1103 c.clamp = random.randrange(2)
1104 c.clear_traps()
1105 return c
1106
1107def test_quantize_api(method, prec, exprange, restricted_range, itr, stat):
1108 """Iterate the 'quantize' method through many test cases, using

Callers 1

test_quantize_apiFunction · 0.85

Calls 3

clear_trapsMethod · 0.95
randrangeMethod · 0.80
ContextClass · 0.70

Tested by 1

test_quantize_apiFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…