diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2013-02-18 10:20:44 (GMT) |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-02-18 10:20:44 (GMT) |
| commit | 142d2bc3f11e8ad362e2e8b63c86445643a217be (patch) | |
| tree | 12a8197c9722ac725e25633001cdf50fd78ca8f1 /Lib/test/test_posixpath.py | |
| parent | fbc737eda1f6dbe78e4de4f15fd7127f6cb585d4 (diff) | |
| download | cpython-142d2bc3f11e8ad362e2e8b63c86445643a217be.zip cpython-142d2bc3f11e8ad362e2e8b63c86445643a217be.tar.gz cpython-142d2bc3f11e8ad362e2e8b63c86445643a217be.tar.bz2 | |
Fix posixpath.realpath() for multiple pardirs (fixes issue #6975).
Diffstat (limited to 'Lib/test/test_posixpath.py')
| -rw-r--r-- | Lib/test/test_posixpath.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py index 23def06..7443e30 100644 --- a/Lib/test/test_posixpath.py +++ b/Lib/test/test_posixpath.py @@ -214,6 +214,16 @@ class PosixPathTest(unittest.TestCase): self.assertEqual(posixpath.normpath("///foo/.//bar//.//..//.//baz"), "/foo/baz") self.assertEqual(posixpath.normpath("///..//./foo/.//bar"), "/foo/bar") + def test_realpath_curdir(self): + self.assertEqual(realpath('.'), os.getcwd()) + self.assertEqual(realpath('./.'), os.getcwd()) + self.assertEqual(realpath('/'.join(['.'] * 100)), os.getcwd()) + + def test_realpath_pardir(self): + self.assertEqual(realpath('..'), dirname(os.getcwd())) + self.assertEqual(realpath('../..'), dirname(dirname(os.getcwd()))) + self.assertEqual(realpath('/'.join(['..'] * 100)), '/') + if hasattr(os, "symlink"): def test_realpath_basic(self): # Basic operation. |
