-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest_module_tree.py
More file actions
65 lines (51 loc) · 1.61 KB
/
Copy pathtest_module_tree.py
File metadata and controls
65 lines (51 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
"""Tests for the module_tree checker."""
from __future__ import annotations
from typing import TYPE_CHECKING
from docs_sync.checkers.module_tree import run
from docs_sync.report import Severity
if TYPE_CHECKING:
from collections.abc import Callable
from pathlib import Path
from docs_sync.config import Config
def test_missing_baseline_path_flagged(
make_workspace: Callable[[dict[str, str]], Path],
make_config: Callable[[Path], Config],
) -> None:
agents = """\
# AGENTS
## Current Module Baseline
- `src/client/connection/`
- `src/nonexistent.rs`
## Next Section
- ignored
"""
root = make_workspace(
{
"AGENTS.md": agents,
"crates/teamtalk/src/client/connection/mod.rs": "",
},
)
cfg = make_config(root)
findings = run(cfg)
paths = sorted(f.actual for f in findings if f.actual is not None)
assert paths == ["src/nonexistent.rs"]
assert findings[0].severity == Severity.WARNING
def test_no_baseline_section_returns_nothing(
make_workspace: Callable[[dict[str, str]], Path],
make_config: Callable[[Path], Config],
) -> None:
root = make_workspace({"AGENTS.md": "# AGENTS\n\nNo baseline here.\n"})
cfg = make_config(root)
assert run(cfg) == []
def test_baseline_accepts_directory_form(
make_workspace: Callable[[dict[str, str]], Path],
make_config: Callable[[Path], Config],
) -> None:
root = make_workspace(
{
"AGENTS.md": "## Current Module Baseline\n- `src/bot/`\n",
"crates/teamtalk/src/bot/mod.rs": "",
},
)
cfg = make_config(root)
assert run(cfg) == []