[Python-Dev] cpython (2.7): Fix posixpath.realpath() for multiple pardirs (fixes issue #6975). (original) (raw)
Serhiy Storchaka storchaka at gmail.com
Mon Feb 18 18:56:07 CET 2013
- Previous message: [Python-Dev] cpython (2.7): Fix posixpath.realpath() for multiple pardirs (fixes issue #6975).
- Next message: [Python-Dev] cpython (2.7): Fix posixpath.realpath() for multiple pardirs (fixes issue #6975).
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 18.02.13 19:26, Antoine Pitrou wrote:
On Mon, 18 Feb 2013 11:24:40 +0100 (CET) serhiy.storchaka <python-checkins at python.org> wrote:
+ def testrealpathcurdir(self): + self.assertEqual(realpath('.'), os.getcwd()) + self.assertEqual(realpath('./.'), os.getcwd()) + self.assertEqual(realpath('/'.join(['.'] * 100)), os.getcwd()) + + def testrealpathpardir(self): + self.assertEqual(realpath('..'), dirname(os.getcwd())) + self.assertEqual(realpath('../..'), dirname(dirname(os.getcwd()))) + self.assertEqual(realpath('/'.join(['..'] * 100)), '/') What if there's a symlink along os.getcwd()?
- AFAIK, os.getcwd() returns the path with resolved symlinks.
- realpath() first resolve relative path and then prepends cwd to the result.
- Previous message: [Python-Dev] cpython (2.7): Fix posixpath.realpath() for multiple pardirs (fixes issue #6975).
- Next message: [Python-Dev] cpython (2.7): Fix posixpath.realpath() for multiple pardirs (fixes issue #6975).
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]