MCPcopy Index your code
hub / github.com/RustPython/RustPython / tester

Function tester

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

Source from the content-addressed store, hash-verified

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

Callers 15

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

Calls 8

_normFunction · 0.85
strFunction · 0.85
reprFunction · 0.85
fsencodeMethod · 0.80
evalFunction · 0.50
replaceMethod · 0.45
decodeMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected