Skip to content

Commit 56cc026

Browse files
[3.12] Add yet few cases for urlparse/urlunparse roundtrip tests (GH-119031) (GH-119036)
(cherry picked from commit 331d385) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
1 parent 387ff96 commit 56cc026

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Lib/test/test_urlparse.py

+17
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ def test_roundtrips(self):
189189
('////path/to/file',
190190
('', '', '//path/to/file', '', '', ''),
191191
('', '', '//path/to/file', '', '')),
192+
('/////path/to/file',
193+
('', '', '///path/to/file', '', '', ''),
194+
('', '', '///path/to/file', '', '')),
192195
('scheme:path/to/file',
193196
('scheme', '', 'path/to/file', '', '', ''),
194197
('scheme', '', 'path/to/file', '', '')),
@@ -201,6 +204,9 @@ def test_roundtrips(self):
201204
('scheme:////path/to/file',
202205
('scheme', '', '//path/to/file', '', '', ''),
203206
('scheme', '', '//path/to/file', '', '')),
207+
('scheme://///path/to/file',
208+
('scheme', '', '///path/to/file', '', '', ''),
209+
('scheme', '', '///path/to/file', '', '')),
204210
('file:///tmp/junk.txt',
205211
('file', '', '/tmp/junk.txt', '', '', ''),
206212
('file', '', '/tmp/junk.txt', '', '')),
@@ -236,12 +242,23 @@ def test_roundtrips(self):
236242
'action=download-manifest&url=https://example.com/app', ''),
237243
('itms-services', '', '',
238244
'action=download-manifest&url=https://example.com/app', '')),
245+
('+scheme:path/to/file',
246+
('', '', '+scheme:path/to/file', '', '', ''),
247+
('', '', '+scheme:path/to/file', '', '')),
248+
('sch_me:path/to/file',
249+
('', '', 'sch_me:path/to/file', '', '', ''),
250+
('', '', 'sch_me:path/to/file', '', '')),
239251
]
240252
def _encode(t):
241253
return (t[0].encode('ascii'),
242254
tuple(x.encode('ascii') for x in t[1]),
243255
tuple(x.encode('ascii') for x in t[2]))
244256
bytes_cases = [_encode(x) for x in str_cases]
257+
str_cases += [
258+
('schème:path/to/file',
259+
('', '', 'schème:path/to/file', '', '', ''),
260+
('', '', 'schème:path/to/file', '', '')),
261+
]
245262
for url, parsed, split in str_cases + bytes_cases:
246263
self.checkRoundtrips(url, parsed, split)
247264

0 commit comments

Comments
 (0)