(path, modes, expected, errno=None)
| 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] |
nothing calls this directly
no test coverage detected