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

Method assertPathEqual

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

Source from the content-addressed store, hash-verified

3077 filelinkb_target = os.fsencode(filelink_target)
3078
3079 def assertPathEqual(self, left, right):
3080 left = os.path.normcase(left)
3081 right = os.path.normcase(right)
3082 if sys.platform == 'win32':
3083 # Bad practice to blindly strip the prefix as it may be required to
3084 # correctly refer to the file, but we're only comparing paths here.
3085 has_prefix = lambda p: p.startswith(
3086 b'\\\\?\\' if isinstance(p, bytes) else '\\\\?\\')
3087 if has_prefix(left):
3088 left = left[4:]
3089 if has_prefix(right):
3090 right = right[4:]
3091 self.assertEqual(left, right)
3092
3093 def setUp(self):
3094 self.assertTrue(os.path.exists(self.filelink_target))

Callers 3

test_pathlikeMethod · 0.95
test_pathlike_bytesMethod · 0.95
test_bytesMethod · 0.95

Calls 3

normcaseMethod · 0.80
startswithMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected