mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
GH-90812: Add test for urlopen()
of file URI for UNC path (#132489)
This commit is contained in:
parent
666eeda13d
commit
f3192dac66
1 changed files with 10 additions and 0 deletions
|
@ -181,6 +181,16 @@ class urlopen_FileTests(unittest.TestCase):
|
|||
def test_relativelocalfile(self):
|
||||
self.assertRaises(ValueError,urllib.request.urlopen,'./' + self.pathname)
|
||||
|
||||
def test_remote_authority(self):
|
||||
# Test for GH-90812.
|
||||
url = 'file://pythontest.net/foo/bar'
|
||||
with self.assertRaises(urllib.error.URLError) as e:
|
||||
urllib.request.urlopen(url)
|
||||
if os.name == 'nt':
|
||||
self.assertEqual(e.exception.filename, r'\\pythontest.net\foo\bar')
|
||||
else:
|
||||
self.assertEqual(e.exception.reason, 'file:// scheme is supported only on localhost')
|
||||
|
||||
|
||||
class ProxyTests(unittest.TestCase):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue