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:
Barney Gale 2024-11-09 18:21:53 +00:00 committed by GitHub
parent 6293d00e72
commit 0f47a3199c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 9 deletions

View file

@ -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')