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

Function tester

Lib/test/test_ntpath.py:59–80  ·  view source on GitHub ↗
(fn, wantResult)

Source from the content-addressed store, hash-verified

57
58
59def tester(fn, wantResult):
60 fn = fn.replace("\\", "\\\\")
61 gotResult = eval(fn)
62 if wantResult != gotResult and _norm(wantResult) != _norm(gotResult):
63 raise support.TestFailed("%s should return: %s but returned: %s" \
64 %(str(fn), str(wantResult), str(gotResult)))
65
66 # then with bytes
67 fn = fn.replace("('", "(b'")
68 fn = fn.replace('("', '(b"')
69 fn = fn.replace("['", "[b'")
70 fn = fn.replace('["', '[b"')
71 fn = fn.replace(", '", ", b'")
72 fn = fn.replace(', "', ', b"')
73 fn = os.fsencode(fn).decode('latin1')
74 fn = fn.encode('ascii', 'backslashreplace').decode('ascii')
75 with warnings.catch_warnings():
76 warnings.simplefilter("ignore", DeprecationWarning)
77 gotResult = eval(fn)
78 if _norm(wantResult) != _norm(gotResult):
79 raise support.TestFailed("%s should return: %s but returned: %s" \
80 %(str(fn), str(wantResult), repr(gotResult)))
81
82
83def _parameterize(*parameters):

Callers 15

test_splitextMethod · 0.85
test_splitdriveMethod · 0.85
test_splitrootMethod · 0.85
test_splitMethod · 0.85
test_isabsMethod · 0.85
do_test_commonprefixMethod · 0.85
test_joinMethod · 0.85
test_normpathMethod · 0.85
test_realpath_curdirMethod · 0.85
test_realpath_pardirMethod · 0.85

Calls 5

_normFunction · 0.85
strFunction · 0.85
replaceMethod · 0.45
decodeMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…