def test_path2fsn_pathlike():
# basic tests for os.fspath
with pytest.raises(TypeError):
os.fspath(PathLike(None))
assert os.fspath(PathLike(fsnative(u"foo"))) == fsnative(u"foo")
assert os.fspath(PathLike(u"\u1234")) == u"\u1234"
# now support in path2fsn
pathlike = PathLike(fsnative(u"foo"))
assert path2fsn(pathlike) == fsnative(u"foo")
# pathlib should also work..
from pathlib import Path
assert path2fsn(Path(".")) == fsnative(u".")
评论列表
文章目录