summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pathlib/test_pathlib.py
diff options
context:
space:
mode:
authorBarney Gale <barney.gale@gmail.com>2024-01-30 14:25:16 (GMT)
committerGitHub <noreply@github.com>2024-01-30 14:25:16 (GMT)
commit809eed48058ea7391df57ead09dff53bcc5d81e9 (patch)
tree310860ec40ccf4fa8d5996e52907979a7a8163c9 /Lib/test/test_pathlib/test_pathlib.py
parente21754d7f8336d4647e28f355d8a3dbd5a2c7545 (diff)
downloadcpython-809eed48058ea7391df57ead09dff53bcc5d81e9.zip
cpython-809eed48058ea7391df57ead09dff53bcc5d81e9.tar.gz
cpython-809eed48058ea7391df57ead09dff53bcc5d81e9.tar.bz2
GH-114610: Fix `pathlib._abc.PurePathBase.with_suffix('.ext')` handling of stems (#114613)
Raise `ValueError` if `with_suffix('.ext')` is called on a path without a stem. Paths may only have a non-empty suffix if they also have a non-empty stem. ABC-only bugfix; no effect on public classes.
Diffstat (limited to 'Lib/test/test_pathlib/test_pathlib.py')
-rw-r--r--Lib/test/test_pathlib/test_pathlib.py7
1 files changed, 0 insertions, 7 deletions
diff --git a/Lib/test/test_pathlib/test_pathlib.py b/Lib/test/test_pathlib/test_pathlib.py
index 5ce3b60..a8cc30e 100644
--- a/Lib/test/test_pathlib/test_pathlib.py
+++ b/Lib/test/test_pathlib/test_pathlib.py
@@ -327,13 +327,6 @@ class PurePathTest(test_pathlib_abc.DummyPurePathTest):
self.assertRaises(ValueError, P('a/b').with_stem, '')
self.assertRaises(ValueError, P('a/b').with_stem, '.')
- def test_with_suffix_empty(self):
- # Path doesn't have a "filename" component.
- P = self.cls
- self.assertRaises(ValueError, P('').with_suffix, '.gz')
- self.assertRaises(ValueError, P('.').with_suffix, '.gz')
- self.assertRaises(ValueError, P('/').with_suffix, '.gz')
-
def test_relative_to_several_args(self):
P = self.cls
p = P('a/b')