mirror of
https://github.com/python/cpython.git
synced 2025-08-10 03:49:18 +00:00
[3.12] gh-117503: Fix support of non-ASCII user names in posixpath.expanduser() (GH-117504) (GH-117970)
They are now supported in bytes paths as well as in string paths.
(cherry picked from commit 51132da0c4
)
This commit is contained in:
parent
ac48fdeb0d
commit
96b29b32c1
3 changed files with 14 additions and 1 deletions
|
@ -334,6 +334,17 @@ class PosixPathTest(unittest.TestCase):
|
|||
for path in ('~', '~/.local', '~vstinner/'):
|
||||
self.assertEqual(posixpath.expanduser(path), path)
|
||||
|
||||
@unittest.skipIf(sys.platform == "vxworks",
|
||||
"no home directory on VxWorks")
|
||||
def test_expanduser_pwd2(self):
|
||||
pwd = import_helper.import_module('pwd')
|
||||
for e in pwd.getpwall():
|
||||
name = e.pw_name
|
||||
home = e.pw_dir
|
||||
self.assertEqual(posixpath.expanduser('~' + name), home)
|
||||
self.assertEqual(posixpath.expanduser(os.fsencode('~' + name)),
|
||||
os.fsencode(home))
|
||||
|
||||
NORMPATH_CASES = [
|
||||
("", "."),
|
||||
("/", "/"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue