mirror of
https://github.com/python/cpython.git
synced 2025-10-17 20:28:43 +00:00
pathlib ABCs: support initializing paths with no arguments (#126608)
In the past I've equivocated about whether to require at least one argument in the `PurePathBase` (and `PathBase`) initializer, and what the default should be if we make it optional. I now have a local use case that has persuaded me to make it optional and default to the empty string (a `zipp.Path`-like class that treats relative and absolute paths similarly.) Happily this brings the base class more in line with `PurePath` and `Path`.
This commit is contained in:
parent
6293d00e72
commit
0f47a3199c
2 changed files with 8 additions and 9 deletions
|
@ -148,6 +148,7 @@ class DummyPurePathTest(unittest.TestCase):
|
|||
P = self.cls
|
||||
p = P('a')
|
||||
self.assertIsInstance(p, P)
|
||||
P()
|
||||
P('a', 'b', 'c')
|
||||
P('/a', 'b', 'c')
|
||||
P('a/b/c')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue