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

28 lines
863 B
Python

from pathlib import Path
from pathlib import PurePosixPath
import pytest
from personal_mcp.registry.ingest.document import MarkdownDocument
pytestmark = pytest.mark.unit
class TestMarkdownDocument:
"""Covers recursive Markdown discovery and loading."""
def test_loads_markdown_in_stable_order(self, tmp_path: Path) -> None:
nested = tmp_path / "guides"
nested.mkdir()
(nested / "b.md").write_text("caf\u00e9\n", encoding="utf-8")
(nested / "a.md").write_text("alpha\n", encoding="utf-8")
(nested / "ignored.txt").write_text("ignored\n", encoding="utf-8")
docs = MarkdownDocument.from_root(tmp_path)
assert list(docs) == [
PurePosixPath("guides/a.md"),
PurePosixPath("guides/b.md"),
]
assert docs[PurePosixPath("guides/b.md")].content == "caf\u00e9\n"