Files
prompts/tests/registry/models/test_document_validation.py
T
2026-08-07 20:07:21 -05:00

34 lines
864 B
Python

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)