]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Add yet few cases for urlparse/urlunparse roundtrip tests (GH-119031)
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 14 May 2024 13:59:21 +0000 (16:59 +0300)
committerGitHub <noreply@github.com>
Tue, 14 May 2024 13:59:21 +0000 (16:59 +0300)
Add yet few cases for urlparse/urlunparse tests

Lib/test/test_urlparse.py

index 2cf03d046a5b8736c48358685a715e02fce9cd4f..4faad733245df97906afe0f9e371c7893a100bb0 100644 (file)
@@ -189,6 +189,9 @@ class UrlParseTestCase(unittest.TestCase):
             ('////path/to/file',
              ('', '', '//path/to/file', '', '', ''),
              ('', '', '//path/to/file', '', '')),
+            ('/////path/to/file',
+             ('', '', '///path/to/file', '', '', ''),
+             ('', '', '///path/to/file', '', '')),
             ('scheme:path/to/file',
              ('scheme', '', 'path/to/file', '', '', ''),
              ('scheme', '', 'path/to/file', '', '')),
@@ -201,6 +204,9 @@ class UrlParseTestCase(unittest.TestCase):
             ('scheme:////path/to/file',
              ('scheme', '', '//path/to/file', '', '', ''),
              ('scheme', '', '//path/to/file', '', '')),
+            ('scheme://///path/to/file',
+             ('scheme', '', '///path/to/file', '', '', ''),
+             ('scheme', '', '///path/to/file', '', '')),
             ('file:///tmp/junk.txt',
              ('file', '', '/tmp/junk.txt', '', '', ''),
              ('file', '', '/tmp/junk.txt', '', '')),
@@ -236,12 +242,23 @@ class UrlParseTestCase(unittest.TestCase):
               'action=download-manifest&url=https://example.com/app', ''),
              ('itms-services', '', '',
               'action=download-manifest&url=https://example.com/app', '')),
+            ('+scheme:path/to/file',
+             ('', '', '+scheme:path/to/file', '', '', ''),
+             ('', '', '+scheme:path/to/file', '', '')),
+            ('sch_me:path/to/file',
+             ('', '', 'sch_me:path/to/file', '', '', ''),
+             ('', '', 'sch_me:path/to/file', '', '')),
             ]
         def _encode(t):
             return (t[0].encode('ascii'),
                     tuple(x.encode('ascii') for x in t[1]),
                     tuple(x.encode('ascii') for x in t[2]))
         bytes_cases = [_encode(x) for x in str_cases]
+        str_cases += [
+            ('schème:path/to/file',
+             ('', '', 'schème:path/to/file', '', '', ''),
+             ('', '', 'schème:path/to/file', '', '')),
+            ]
         for url, parsed, split in str_cases + bytes_cases:
             self.checkRoundtrips(url, parsed, split)