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

Function test_unary

Modules/_decimal/tests/deccheck.py:963–986  ·  view source on GitHub ↗

Iterate a unary function through many test cases.

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

Source from the content-addressed store, hash-verified

961 log(" result types: %s" % sorted([t for t in stat.items()]))
962
963def test_unary(method, prec, exp_range, restricted_range, itr, stat):
964 """Iterate a unary function through many test cases."""
965 if method in UnaryRestricted:
966 exp_range = restricted_range
967 for op in all_unary(prec, exp_range, itr):
968 t = TestSet(method, op)
969 try:
970 if not convert(t):
971 continue
972 callfuncs(t)
973 verify(t, stat)
974 except VerifyError as err:
975 log(err)
976
977 if not method.startswith('__'):
978 for op in unary_optarg(prec, exp_range, itr):
979 t = TestSet(method, op)
980 try:
981 if not convert(t):
982 continue
983 callfuncs(t)
984 verify(t, stat)
985 except VerifyError as err:
986 log(err)
987
988def test_binary(method, prec, exp_range, restricted_range, itr, stat):
989 """Iterate a binary function through many test cases."""

Callers

nothing calls this directly

Calls 8

all_unaryFunction · 0.90
unary_optargFunction · 0.90
callfuncsFunction · 0.85
TestSetClass · 0.70
convertFunction · 0.70
verifyFunction · 0.70
logFunction · 0.70
startswithMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…