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

Method check

Lib/test/test_ntpath.py:1030–1045  ·  view source on GitHub ↗
(path, modes, expected, errno=None)

Source from the content-addressed store, hash-verified

1028 os.symlink("nonexistent", ABSTFN + "\\broken")
1029 os.symlink("cycle", ABSTFN + "\\cycle")
1030 def check(path, modes, expected, errno=None):
1031 path = path.replace('/', '\\')
1032 if isinstance(expected, str):
1033 assert errno is None
1034 expected = expected.replace('/', os.sep)
1035 for mode in modes:
1036 with self.subTest(mode=mode):
1037 self.assertEqual(realpath(path, strict=mode),
1038 ABSTFN + expected)
1039 else:
1040 for mode in modes:
1041 with self.subTest(mode=mode):
1042 with self.assertRaises(expected) as cm:
1043 realpath(path, strict=mode)
1044 if errno is not None:
1045 self.assertEqual(cm.exception.errno, errno)
1046
1047 self.enterContext(os_helper.change_cwd(ABSTFN))
1048 all_modes = [False, ALLOW_MISSING, ALL_BUT_LAST, True]

Callers

nothing calls this directly

Calls 6

testerFunction · 0.85
realpathFunction · 0.50
replaceMethod · 0.45
subTestMethod · 0.45
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected