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

Function test_format

Modules/_decimal/tests/deccheck.py:1038–1065  ·  view source on GitHub ↗

Iterate the __format__ method through many test cases.

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

Source from the content-addressed store, hash-verified

1036 log(err)
1037
1038def test_format(method, prec, exp_range, restricted_range, itr, stat):
1039 """Iterate the __format__ method through many test cases."""
1040 for op in all_unary(prec, exp_range, itr):
1041 fmt1 = rand_format(chr(random.randrange(0, 128)), 'EeGgn')
1042 fmt2 = rand_locale()
1043 for fmt in (fmt1, fmt2):
1044 fmtop = (op[0], fmt)
1045 t = TestSet(method, fmtop)
1046 try:
1047 if not convert(t, convstr=False):
1048 continue
1049 callfuncs(t)
1050 verify(t, stat)
1051 except VerifyError as err:
1052 log(err)
1053 for op in all_unary(prec, 9999, itr):
1054 fmt1 = rand_format(chr(random.randrange(0, 128)), 'Ff%')
1055 fmt2 = rand_locale()
1056 for fmt in (fmt1, fmt2):
1057 fmtop = (op[0], fmt)
1058 t = TestSet(method, fmtop)
1059 try:
1060 if not convert(t, convstr=False):
1061 continue
1062 callfuncs(t)
1063 verify(t, stat)
1064 except VerifyError as err:
1065 log(err)
1066
1067def test_round(method, prec, exprange, restricted_range, itr, stat):
1068 """Iterate the __round__ method through many test cases."""

Callers

nothing calls this directly

Calls 9

all_unaryFunction · 0.90
rand_formatFunction · 0.90
rand_localeFunction · 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…