diff options
author | Sebastian Rittau <srittau@rittau.biz> | 2024-02-18 08:24:58 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-18 08:24:58 (GMT) |
commit | 371c9708863c23ddc716085198ab07fa49968166 (patch) | |
tree | 305ca06fc4fa5d87a8ff08e2a01dc3eba0a2d802 /Lib/test/test_posixpath.py | |
parent | f9154f8f237e31e7c30f8698f980bee5e494f1e0 (diff) | |
download | cpython-371c9708863c23ddc716085198ab07fa49968166.zip cpython-371c9708863c23ddc716085198ab07fa49968166.tar.gz cpython-371c9708863c23ddc716085198ab07fa49968166.tar.bz2 |
gh-114709: Fix exceptions raised by posixpath.commonpath (#114710)
Fix the exceptions raised by posixpath.commonpath
Raise ValueError, not IndexError when passed an empty iterable. Raise
TypeError, not ValueError when passed None.
Diffstat (limited to 'Lib/test/test_posixpath.py')
-rw-r--r-- | Lib/test/test_posixpath.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py index 86ce1b1..cbb7c4c 100644 --- a/Lib/test/test_posixpath.py +++ b/Lib/test/test_posixpath.py @@ -703,7 +703,9 @@ class PosixPathTest(unittest.TestCase): self.assertRaises(exc, posixpath.commonpath, [os.fsencode(p) for p in paths]) + self.assertRaises(TypeError, posixpath.commonpath, None) self.assertRaises(ValueError, posixpath.commonpath, []) + self.assertRaises(ValueError, posixpath.commonpath, iter([])) check_error(ValueError, ['/usr', 'usr']) check_error(ValueError, ['usr', '/usr']) |