mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
gh-117335: Handle non-iterables for ntpath.commonpath
(GH-117336)
This commit is contained in:
parent
18cf239e39
commit
14f1ca7d53
3 changed files with 10 additions and 7 deletions
|
@ -871,11 +871,14 @@ class TestNtpath(NtpathTestCase):
|
|||
self.assertRaises(exc, ntpath.commonpath,
|
||||
[os.fsencode(p) for p in paths])
|
||||
|
||||
self.assertRaises(TypeError, ntpath.commonpath, None)
|
||||
self.assertRaises(ValueError, ntpath.commonpath, [])
|
||||
self.assertRaises(ValueError, ntpath.commonpath, iter([]))
|
||||
check_error(ValueError, ['C:\\Program Files', 'Program Files'])
|
||||
check_error(ValueError, ['C:\\Program Files', 'C:Program Files'])
|
||||
check_error(ValueError, ['\\Program Files', 'Program Files'])
|
||||
check_error(ValueError, ['Program Files', 'C:\\Program Files'])
|
||||
|
||||
check(['C:\\Program Files'], 'C:\\Program Files')
|
||||
check(['C:\\Program Files', 'C:\\Program Files'], 'C:\\Program Files')
|
||||
check(['C:\\Program Files\\', 'C:\\Program Files'],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue