diff options
author | Barney Gale <barney.gale@gmail.com> | 2024-12-22 01:17:59 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-22 01:17:59 +0000 |
commit | a959ea1b0a026ff118975b9b539513b06dde3190 (patch) | |
tree | 32be56a9194e7e349aa75bfd6a299e35754de8dd /Lib/test/test_pathlib/test_pathlib.py | |
parent | 2a66dd33dfc0b845042da9bb54aaa4e890733f54 (diff) | |
download | cpython-a959ea1b0a026ff118975b9b539513b06dde3190.tar.gz cpython-a959ea1b0a026ff118975b9b539513b06dde3190.zip |
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.
Diffstat (limited to 'Lib/test/test_pathlib/test_pathlib.py')
-rw-r--r-- | Lib/test/test_pathlib/test_pathlib.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Lib/test/test_pathlib/test_pathlib.py b/Lib/test/test_pathlib/test_pathlib.py index ac3a3b4f15c..ef482c31154 100644 --- a/Lib/test/test_pathlib/test_pathlib.py +++ b/Lib/test/test_pathlib/test_pathlib.py @@ -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 " |