mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
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.
This commit is contained in:
parent
f9154f8f23
commit
371c970886
4 changed files with 11 additions and 3 deletions
|
@ -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'])
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue