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