mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-86943: implement pathlib.WindowsPath.is_mount()
(GH-31458)
Have `pathlib.WindowsPath.is_mount()` call `ntpath.ismount()`. Previously it raised `NotImplementedError` unconditionally. https://bugs.python.org/issue42777
This commit is contained in:
parent
a302a27489
commit
29650fea96
4 changed files with 14 additions and 24 deletions
|
@ -2294,10 +2294,12 @@ class _BasePathTest(object):
|
|||
self.assertIs((P / 'fileA\udfff').is_file(), False)
|
||||
self.assertIs((P / 'fileA\x00').is_file(), False)
|
||||
|
||||
@only_posix
|
||||
def test_is_mount(self):
|
||||
P = self.cls(BASE)
|
||||
R = self.cls('/') # TODO: Work out Windows.
|
||||
if os.name == 'nt':
|
||||
R = self.cls('c:\\')
|
||||
else:
|
||||
R = self.cls('/')
|
||||
self.assertFalse((P / 'fileA').is_mount())
|
||||
self.assertFalse((P / 'dirA').is_mount())
|
||||
self.assertFalse((P / 'non-existing').is_mount())
|
||||
|
@ -2305,8 +2307,7 @@ class _BasePathTest(object):
|
|||
self.assertTrue(R.is_mount())
|
||||
if os_helper.can_symlink():
|
||||
self.assertFalse((P / 'linkA').is_mount())
|
||||
self.assertIs(self.cls('/\udfff').is_mount(), False)
|
||||
self.assertIs(self.cls('/\x00').is_mount(), False)
|
||||
self.assertIs((R / '\udfff').is_mount(), False)
|
||||
|
||||
def test_is_symlink(self):
|
||||
P = self.cls(BASE)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue