Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: use cross-platform absolute path check in file_browser test (#8699)

Shahmir Varqhae47bb363e2c4
diff --git a/tests/_plugins/ui/_impl/test_file_browser.py b/tests/_plugins/ui/_impl/test_file_browser.py
index 23a1e8976e..100ed5ddd0 100644
--- a/tests/_plugins/ui/_impl/test_file_browser.py
+++ b/tests/_plugins/ui/_impl/test_file_browser.py
@@ -968,11 +968,10 @@ def test_file_browser_relative_path_sent_to_frontend_as_absolute(
for rel_path in ["subdir", "./subdir", Path("subdir")]:
fb = file_browser(initial_path=rel_path)
initial_path_arg = str(fb._component_args["initial-path"]) # pyright: ignore[reportPrivateUsage]
- assert "/" in initial_path_arg, (
- f"initial-path sent to frontend must contain '/' "
- f"(be absolute), got: {initial_path_arg!r}"
+ assert Path(initial_path_arg).is_absolute(), (
+ f"initial-path sent to frontend must be absolute, "
+ f"got: {initial_path_arg!r}"
)
- assert Path(initial_path_arg).is_absolute()
# Navigating up from the initial path should work
parent = str(Path(initial_path_arg).parent)