From 6c138d0edbe17752b487e4037c3b5986f27a3220 Mon Sep 17 00:00:00 2001 From: Andreas Poehlmann Date: Mon, 29 Sep 2025 23:02:34 +0200 Subject: [PATCH] tests: add a os.PathLike test --- upath/tests/implementations/test_local.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/upath/tests/implementations/test_local.py b/upath/tests/implementations/test_local.py index cb446bcb..ebb0d22e 100644 --- a/upath/tests/implementations/test_local.py +++ b/upath/tests/implementations/test_local.py @@ -1,3 +1,4 @@ +import os from pathlib import Path import pytest @@ -47,3 +48,15 @@ def test_home(self): cwd = type(self.path).home() assert isinstance(cwd, LocalPath) assert cwd.path == Path.home().as_posix() + + +@pytest.mark.parametrize( + "protocol,path", + [ + (None, "/tmp/somefile.txt"), + ("file", "file:///tmp/somefile.txt"), + ("local", "local:///tmp/somefile.txt"), + ], +) +def test_local_paths_are_pathlike(protocol, path): + assert isinstance(UPath(path, protocol=protocol), os.PathLike)