mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
GH-127807: pathlib ABCs: remove PurePathBase._raw_paths
(#127883)
Remove the `PurePathBase` initializer, and make `with_segments()` and `__str__()` abstract. This allows us to drop the `_raw_paths` attribute, and also the `Parser.join()` protocol method.
This commit is contained in:
parent
2a66dd33df
commit
a959ea1b0a
5 changed files with 92 additions and 96 deletions
|
@ -229,6 +229,31 @@ class PurePathTest(test_pathlib_abc.DummyPurePathTest):
|
|||
self._check_str(p.__fspath__(), ('a/b',))
|
||||
self._check_str(os.fspath(p), ('a/b',))
|
||||
|
||||
def test_bytes(self):
|
||||
P = self.cls
|
||||
with self.assertRaises(TypeError):
|
||||
P(b'a')
|
||||
with self.assertRaises(TypeError):
|
||||
P(b'a', 'b')
|
||||
with self.assertRaises(TypeError):
|
||||
P('a', b'b')
|
||||
with self.assertRaises(TypeError):
|
||||
P('a').joinpath(b'b')
|
||||
with self.assertRaises(TypeError):
|
||||
P('a') / b'b'
|
||||
with self.assertRaises(TypeError):
|
||||
b'a' / P('b')
|
||||
with self.assertRaises(TypeError):
|
||||
P('a').match(b'b')
|
||||
with self.assertRaises(TypeError):
|
||||
P('a').relative_to(b'b')
|
||||
with self.assertRaises(TypeError):
|
||||
P('a').with_name(b'b')
|
||||
with self.assertRaises(TypeError):
|
||||
P('a').with_stem(b'b')
|
||||
with self.assertRaises(TypeError):
|
||||
P('a').with_suffix(b'b')
|
||||
|
||||
def test_bytes_exc_message(self):
|
||||
P = self.cls
|
||||
message = (r"argument should be a str or an os\.PathLike object "
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue