gh-117584: Raise TypeError for non-paths in posixpath.relpath() (GH-117585)

This commit is contained in:
Nice Zombies 2024-04-07 11:00:08 +02:00 committed by GitHub
parent 62aeb0ee69
commit 733e56ef96
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 1 deletions

View file

@ -650,6 +650,7 @@ class PosixPathTest(unittest.TestCase):
(real_getcwd, os.getcwd) = (os.getcwd, lambda: r"/home/user/bar")
try:
curdir = os.path.split(os.getcwd())[-1]
self.assertRaises(TypeError, posixpath.relpath, None)
self.assertRaises(ValueError, posixpath.relpath, "")
self.assertEqual(posixpath.relpath("a"), "a")
self.assertEqual(posixpath.relpath(posixpath.abspath("a")), "a")