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

Function test_round

Modules/_decimal/tests/deccheck.py:1067–1079  ·  view source on GitHub ↗

Iterate the __round__ method through many test cases.

(method, prec, exprange, restricted_range, itr, stat)

Source from the content-addressed store, hash-verified

1065 log(err)
1066
1067def test_round(method, prec, exprange, restricted_range, itr, stat):
1068 """Iterate the __round__ method through many test cases."""
1069 for op in all_unary(prec, 9999, itr):
1070 n = random.randrange(10)
1071 roundop = (op[0], n)
1072 t = TestSet(method, roundop)
1073 try:
1074 if not convert(t):
1075 continue
1076 callfuncs(t)
1077 verify(t, stat)
1078 except VerifyError as err:
1079 log(err)
1080
1081def test_from_float(method, prec, exprange, restricted_range, itr, stat):
1082 """Iterate the __float__ method through many test cases."""

Callers

nothing calls this directly

Calls 7

all_unaryFunction · 0.90
callfuncsFunction · 0.85
randrangeMethod · 0.80
TestSetClass · 0.70
convertFunction · 0.70
verifyFunction · 0.70
logFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…