from __future__ import annotations from pathlib import PurePosixPath import pytest from personal_mcp.registry.models.common import parse_docs_path pytestmark = pytest.mark.unit class TestDocsPathValidation: """Covers canonical resource-path contracts.""" def test_parse_docs_path_returns_pure_posix_path(self) -> None: path = parse_docs_path("guides/demo.md") assert path == PurePosixPath("guides/demo.md") assert isinstance(path, PurePosixPath) @pytest.mark.parametrize( "value", ( "/absolute.md", "../outside.md", "guides\\demo.md", "guides//demo.md", "guides/demo.txt", ), ) def test_parse_docs_path_rejects_invalid_paths(self, value: str) -> None: with pytest.raises(ValueError): parse_docs_path(value)