(self)
| 1222 | self._test_cwd(p) |
| 1223 | |
| 1224 | def test_absolute_common(self): |
| 1225 | P = self.cls |
| 1226 | |
| 1227 | with mock.patch("os.getcwd") as getcwd: |
| 1228 | getcwd.return_value = self.base |
| 1229 | |
| 1230 | # Simple relative paths. |
| 1231 | self.assertEqual(str(P().absolute()), self.base) |
| 1232 | self.assertEqual(str(P('.').absolute()), self.base) |
| 1233 | self.assertEqual(str(P('a').absolute()), os.path.join(self.base, 'a')) |
| 1234 | self.assertEqual(str(P('a', 'b', 'c').absolute()), os.path.join(self.base, 'a', 'b', 'c')) |
| 1235 | |
| 1236 | # Symlinks should not be resolved. |
| 1237 | self.assertEqual(str(P('linkB', 'fileB').absolute()), os.path.join(self.base, 'linkB', 'fileB')) |
| 1238 | self.assertEqual(str(P('brokenLink').absolute()), os.path.join(self.base, 'brokenLink')) |
| 1239 | self.assertEqual(str(P('brokenLinkLoop').absolute()), os.path.join(self.base, 'brokenLinkLoop')) |
| 1240 | |
| 1241 | # '..' entries should be preserved and not normalised. |
| 1242 | self.assertEqual(str(P('..').absolute()), os.path.join(self.base, '..')) |
| 1243 | self.assertEqual(str(P('a', '..').absolute()), os.path.join(self.base, 'a', '..')) |
| 1244 | self.assertEqual(str(P('..', 'b').absolute()), os.path.join(self.base, '..', 'b')) |
| 1245 | |
| 1246 | def _test_home(self, p): |
| 1247 | q = self.cls(os.path.expanduser('~')) |
nothing calls this directly
no test coverage detected