mirror of
https://github.com/python/cpython.git
synced 2025-10-21 14:12:27 +00:00
GH-127381: pathlib ABCs: remove remaining uncommon PathBase
methods (#127714)
Remove the following methods from `pathlib._abc.PathBase`: - `expanduser()` - `hardlink_to()` - `touch()` - `chmod()` - `lchmod()` - `owner()` - `group()` - `from_uri()` - `as_uri()` These operations aren't regularly supported in virtual filesystems, so they don't win a place in the `PathBase` interface. (Some of them probably don't deserve a place in `Path` :P.) They're quasi-abstract (except `lchmod()`), and they're not called by other `PathBase` methods.
This commit is contained in:
parent
8bbd379ee3
commit
292afd1d51
3 changed files with 27 additions and 67 deletions
|
@ -1312,21 +1312,9 @@ class PathBaseTest(PurePathBaseTest):
|
|||
self.assertRaises(e, lambda: list(p.glob('*')))
|
||||
self.assertRaises(e, lambda: list(p.rglob('*')))
|
||||
self.assertRaises(e, lambda: list(p.walk()))
|
||||
self.assertRaises(e, p.expanduser)
|
||||
self.assertRaises(e, p.readlink)
|
||||
self.assertRaises(e, p.symlink_to, 'foo')
|
||||
self.assertRaises(e, p.hardlink_to, 'foo')
|
||||
self.assertRaises(e, p.mkdir)
|
||||
self.assertRaises(e, p.touch)
|
||||
self.assertRaises(e, p.chmod, 0o755)
|
||||
self.assertRaises(e, p.lchmod, 0o755)
|
||||
self.assertRaises(e, p.owner)
|
||||
self.assertRaises(e, p.group)
|
||||
self.assertRaises(e, p.as_uri)
|
||||
|
||||
def test_as_uri_common(self):
|
||||
e = UnsupportedOperation
|
||||
self.assertRaises(e, self.cls('').as_uri)
|
||||
|
||||
def test_fspath_common(self):
|
||||
self.assertRaises(TypeError, os.fspath, self.cls(''))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue