diff options
| author | Barney Gale <barney.gale@gmail.com> | 2024-01-31 00:59:33 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-31 00:59:33 (GMT) |
| commit | 574291963f6b0eb7da3fde1ae9763236e7ece306 (patch) | |
| tree | 54639605dc0db7b2e69c0b54527ca939a9acaa4d /Lib/test/test_pathlib/test_pathlib.py | |
| parent | 1667c2868633a1091b3519594103ca7662d64d75 (diff) | |
| download | cpython-574291963f6b0eb7da3fde1ae9763236e7ece306.zip cpython-574291963f6b0eb7da3fde1ae9763236e7ece306.tar.gz cpython-574291963f6b0eb7da3fde1ae9763236e7ece306.tar.bz2 | |
pathlib ABCs: drop partial, broken, untested support for `bytes` paths. (#114777)
Methods like `full_match()`, `glob()`, etc, are difficult to make work with
byte paths, and it's not worth the effort. This patch makes `PurePathBase`
raise `TypeError` when given non-`str` path segments.
Diffstat (limited to 'Lib/test/test_pathlib/test_pathlib.py')
| -rw-r--r-- | Lib/test/test_pathlib/test_pathlib.py | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/Lib/test/test_pathlib/test_pathlib.py b/Lib/test/test_pathlib/test_pathlib.py index 3bee9b8..2b16645 100644 --- a/Lib/test/test_pathlib/test_pathlib.py +++ b/Lib/test/test_pathlib/test_pathlib.py @@ -189,7 +189,7 @@ 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): + def test_bytes_exc_message(self): P = self.cls message = (r"argument should be a str or an os\.PathLike object " r"where __fspath__ returns a str, not 'bytes'") @@ -199,22 +199,6 @@ class PurePathTest(test_pathlib_abc.DummyPurePathTest): P(b'a', 'b') with self.assertRaisesRegex(TypeError, message): 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_as_bytes_common(self): sep = os.fsencode(self.sep) |
