mirror of
https://github.com/python/cpython.git
synced 2025-09-06 17:02:26 +00:00
GH-125866: Support complete "file:" URLs in urllib (#132378)
Add optional *add_scheme* argument to `urllib.request.pathname2url()`; when set to true, a complete URL is returned. Likewise add optional *require_scheme* argument to `url2pathname()`; when set to true, a complete URL is accepted. Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
parent
4d3ad0467e
commit
ccad61e35d
9 changed files with 121 additions and 33 deletions
|
@ -3302,8 +3302,8 @@ class PathTest(PurePathTest):
|
|||
@needs_posix
|
||||
def test_from_uri_pathname2url_posix(self):
|
||||
P = self.cls
|
||||
self.assertEqual(P.from_uri('file:' + pathname2url('/foo/bar')), P('/foo/bar'))
|
||||
self.assertEqual(P.from_uri('file:' + pathname2url('//foo/bar')), P('//foo/bar'))
|
||||
self.assertEqual(P.from_uri(pathname2url('/foo/bar', add_scheme=True)), P('/foo/bar'))
|
||||
self.assertEqual(P.from_uri(pathname2url('//foo/bar', add_scheme=True)), P('//foo/bar'))
|
||||
|
||||
@needs_windows
|
||||
def test_absolute_windows(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue