mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
GH-110109: Move pathlib ABCs to new pathlib._abc
module. (#112881)
Move `_PurePathBase` and `_PathBase` to a new `pathlib._abc` module, and drop the underscores from the class names. Tests are mostly left alone in this commit, but they'll be similarly split in a subsequent commit. The `pathlib._abc` module will be published as an independent PyPI package (similar to how `zipfile._path` is published as `zipp`), to be refined and stabilised prior to its possible addition to the standard library.
This commit is contained in:
parent
c98c40227e
commit
a98e7a8112
3 changed files with 518 additions and 511 deletions
|
@ -51,7 +51,7 @@ if hasattr(os, 'geteuid'):
|
|||
|
||||
|
||||
class PurePathBaseTest(unittest.TestCase):
|
||||
cls = pathlib._PurePathBase
|
||||
cls = pathlib._abc.PurePathBase
|
||||
|
||||
def test_magic_methods(self):
|
||||
P = self.cls
|
||||
|
@ -66,7 +66,7 @@ class PurePathBaseTest(unittest.TestCase):
|
|||
self.assertIs(P.__ge__, object.__ge__)
|
||||
|
||||
|
||||
class DummyPurePath(pathlib._PurePathBase):
|
||||
class DummyPurePath(pathlib._abc.PurePathBase):
|
||||
def __eq__(self, other):
|
||||
if not isinstance(other, DummyPurePath):
|
||||
return NotImplemented
|
||||
|
@ -1586,7 +1586,7 @@ class PurePathSubclassTest(PurePathTest):
|
|||
#
|
||||
|
||||
class PathBaseTest(PurePathBaseTest):
|
||||
cls = pathlib._PathBase
|
||||
cls = pathlib._abc.PathBase
|
||||
|
||||
def test_unsupported_operation(self):
|
||||
P = self.cls
|
||||
|
@ -1667,7 +1667,7 @@ class DummyPathIO(io.BytesIO):
|
|||
super().close()
|
||||
|
||||
|
||||
class DummyPath(pathlib._PathBase):
|
||||
class DummyPath(pathlib._abc.PathBase):
|
||||
"""
|
||||
Simple implementation of PathBase that keeps files and directories in
|
||||
memory.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue