[3.13] gh-127217: Fix pathname2url() for paths starting with multiple slashes on Posix (GH-127218) (GH-127230)

(cherry picked from commit 97b2ceaaaf)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
Miss Islington (bot) 2024-11-30 10:11:24 +01:00 committed by GitHub
parent 4cba0e66c2
commit c711deb803
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 0 deletions

View file

@ -1556,6 +1556,9 @@ class Pathname_Tests(unittest.TestCase):
fn = urllib.request.pathname2url
self.assertEqual(fn('/'), '/')
self.assertEqual(fn('/a/b.c'), '/a/b.c')
self.assertEqual(fn('//a/b.c'), '////a/b.c')
self.assertEqual(fn('///a/b.c'), '/////a/b.c')
self.assertEqual(fn('////a/b.c'), '//////a/b.c')
self.assertEqual(fn('/a/b%#c'), '/a/b%25%23c')
@unittest.skipUnless(os_helper.FS_NONASCII, 'need os_helper.FS_NONASCII')