mirror of
https://github.com/python/cpython.git
synced 2025-10-17 20:28:43 +00:00
pathlib ABCs: defer path joining (#126409)
Defer joining of path segments in the private `PurePathBase` ABC. The new behaviour matches how the public `PurePath` class handles path segments. This removes a hard-to-grok difference between the ABCs and the main classes. It also slightly reduces the size of `PurePath` objects by eliminating a `_raw_path` slot.
This commit is contained in:
parent
f51fd84034
commit
5e9168492f
3 changed files with 43 additions and 46 deletions
|
@ -86,11 +86,6 @@ class PurePathBaseTest(unittest.TestCase):
|
|||
p.suffix
|
||||
with self.assertRaises(e):
|
||||
p.suffixes
|
||||
with self.assertRaises(e):
|
||||
p / 'bar'
|
||||
with self.assertRaises(e):
|
||||
'bar' / p
|
||||
self.assertRaises(e, p.joinpath, 'bar')
|
||||
self.assertRaises(e, p.with_name, 'bar')
|
||||
self.assertRaises(e, p.with_stem, 'bar')
|
||||
self.assertRaises(e, p.with_suffix, '.txt')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue