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

Method assertPathEqual

Lib/test/test_os.py:3031–3043  ·  view source on GitHub ↗
(self, left, right)

Source from the content-addressed store, hash-verified

3029 filelinkb_target = os.fsencode(filelink_target)
3030
3031 def assertPathEqual(self, left, right):
3032 left = os.path.normcase(left)
3033 right = os.path.normcase(right)
3034 if sys.platform == 'win32':
3035 # Bad practice to blindly strip the prefix as it may be required to
3036 # correctly refer to the file, but we're only comparing paths here.
3037 has_prefix = lambda p: p.startswith(
3038 b'\\\\?\\' if isinstance(p, bytes) else '\\\\?\\')
3039 if has_prefix(left):
3040 left = left[4:]
3041 if has_prefix(right):
3042 right = right[4:]
3043 self.assertEqual(left, right)
3044
3045 def setUp(self):
3046 self.assertTrue(os.path.exists(self.filelink_target))

Callers 3

test_pathlikeMethod · 0.95
test_pathlike_bytesMethod · 0.95
test_bytesMethod · 0.95

Calls 4

isinstanceFunction · 0.85
normcaseMethod · 0.80
startswithMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected