def relpath(path, start=None):
"""Return a relative version of a path"""
+ path = os.fspath(path)
if not path:
raise ValueError("no path specified")
- path = os.fspath(path)
if isinstance(path, bytes):
curdir = b'.'
sep = b'/'
(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")