]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-117503: Fix test for posixpath.expanduser() when pw_dir ends with / (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 18 Apr 2024 17:17:05 +0000 (19:17 +0200)
committerGitHub <noreply@github.com>
Thu, 18 Apr 2024 17:17:05 +0000 (17:17 +0000)
(cherry picked from commit ccdcd1d95a9d6eda4df86811c4539f204beef817)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Lib/test/test_posixpath.py

index ddc097548542fc407c6291b5017fb617f58b5ece..f08bdeaf1361562f7301cb2b95f77b1b4e6f704b 100644 (file)
@@ -341,6 +341,7 @@ class PosixPathTest(unittest.TestCase):
         for e in pwd.getpwall():
             name = e.pw_name
             home = e.pw_dir
+            home = home.rstrip('/') or '/'
             self.assertEqual(posixpath.expanduser('~' + name), home)
             self.assertEqual(posixpath.expanduser(os.fsencode('~' + name)),
                              os.fsencode(home))