test_prose_markdown_coverage.py¶
tests/test_prose_markdown_coverage.py
Every markdown file the build scanned is prose, not only the ten paths a list named.
test_a_file_both_a_glob_and_the_scan_name_is_ingested_once
None test_prose_markdown_coverage.test_a_file_both_a_glob_and_the_scan_name_is_ingested_once(Path tmp_path)
The union dedupes.
tests/test_prose_markdown_coverage.py:123
Checks
assert sorted(headings) == ["One", "Repo"], headings
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-INDEX-002 | measured | test_a_file_both_a_glob_and_the_scan_name_is_ingested_once → ingest_supplementary_docs → _ingest_one_doc_file → memoized |
| REQ-DDB-PIPE-001 | measured | test_a_file_both_a_glob_and_the_scan_name_is_ingested_once → ingest_supplementary_docs |
| REQ-DDB-PIPE-014 | measured | test_a_file_both_a_glob_and_the_scan_name_is_ingested_once → ingest_supplementary_docs → within_repo |
Source · 22 lines
def test_a_file_both_a_glob_and_the_scan_name_is_ingested_once(tmp_path: Path) -> None:
"""`README.md` is named by the glob list AND is markdown in the scanned set, so it is
offered twice. Each section must appear once.
Both headings carry a body: `chunk_markdown` drops a heading with no content on
purpose, so a heading-only section would be absent for a reason unrelated to deduping.
@brief The union dedupes. @version 1
"""
root = tmp_path / "repo"
_write(root, "README.md", "# Repo\n\nTop.\n\n## One\n\nA.\n")
db = tmp_path / "clew.db"
db.touch()
ingest_supplementary_docs(db, root, files=["README.md"])
conn = sqlite3.connect(str(db))
try:
headings = [r[0] for r in conn.execute("SELECT heading FROM supplementary_docs")]
finally:
conn.close()
assert sorted(headings) == ["One", "Repo"], headings1 more lines, not shown
Activity · 9 steps
test_a_markdown_file_the_old_globs_never_named_is_ingested
None test_prose_markdown_coverage.test_a_markdown_file_the_old_globs_never_named_is_ingested(Path tmp_path)
A scanned `.md` anywhere in the tree becomes prose.
tests/test_prose_markdown_coverage.py:51
Checks
assert _ingested(db) == {
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-INDEX-002 | measured | test_a_markdown_file_the_old_globs_never_named_is_ingested → ingest_supplementary_docs → _ingest_one_doc_file → memoized |
| REQ-DDB-PIPE-001 | measured | test_a_markdown_file_the_old_globs_never_named_is_ingested → ingest_supplementary_docs |
| REQ-DDB-PIPE-014 | measured | test_a_markdown_file_the_old_globs_never_named_is_ingested → ingest_supplementary_docs → within_repo |
Source · 25 lines
def test_a_markdown_file_the_old_globs_never_named_is_ingested(tmp_path: Path) -> None:
"""The exact gap sumac reported: markdown outside `docs/` and not called README.
@brief A scanned `.md` anywhere in the tree becomes prose. @version 1
"""
root = tmp_path / "repo"
_write(root, "README.md", "# Repo\n\nTop level.\n")
_write(root, "src/notes.md", "# Notes\n\nWhy the cache keys on content.\n")
_write(root, "architecture/decisions/0003-split.md", "# ADR 3\n\nSplit the index.\n")
db = tmp_path / "clew.db"
db.touch()
ingest_supplementary_docs(
db,
root,
files=["README.md", "src/notes.md", "architecture/decisions/0003-split.md"],
)
assert _ingested(db) == {
"README.md",
"src/notes.md",
"architecture/decisions/0003-split.md",
}
Activity · 8 steps
test_markdown_outside_the_scanned_set_is_not_ingested
None test_prose_markdown_coverage.test_markdown_outside_the_scanned_set_is_not_ingested(Path tmp_path)
Prose coverage honours the build's scope and excludes.
tests/test_prose_markdown_coverage.py:76
Checks
assert _ingested(db) == {"docs/design.md"}
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-INDEX-002 | measured | test_markdown_outside_the_scanned_set_is_not_ingested → ingest_supplementary_docs → _ingest_one_doc_file → memoized |
| REQ-DDB-PIPE-001 | measured | test_markdown_outside_the_scanned_set_is_not_ingested → ingest_supplementary_docs |
| REQ-DDB-PIPE-014 | measured | test_markdown_outside_the_scanned_set_is_not_ingested → ingest_supplementary_docs → within_repo |
Source · 17 lines
def test_markdown_outside_the_scanned_set_is_not_ingested(tmp_path: Path) -> None:
"""THE REASON THIS IS NOT A WIDER GLOB. Both files are markdown on disk and inside the
repository; one is in scope and one was excluded. A `**/*.md` would take both.
@brief Prose coverage honours the build's scope and excludes. @version 1
"""
root = tmp_path / "repo"
_write(root, "docs/design.md", "# Design\n\nOurs.\n")
_write(root, "node_modules/left-pad/README.md", "# left-pad\n\nTheirs.\n")
db = tmp_path / "clew.db"
db.touch()
ingest_supplementary_docs(db, root, files=["docs/design.md"])
assert _ingested(db) == {"docs/design.md"}
Activity · 7 steps
test_the_dotmarkdown_spelling_counts
None test_prose_markdown_coverage.test_the_dotmarkdown_spelling_counts(Path tmp_path)
`.markdown` is markdown.
tests/test_prose_markdown_coverage.py:93
Checks
assert _ingested(db) == {"notes.markdown"}
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-INDEX-002 | measured | test_the_dotmarkdown_spelling_counts → ingest_supplementary_docs → _ingest_one_doc_file → memoized |
| REQ-DDB-PIPE-001 | measured | test_the_dotmarkdown_spelling_counts → ingest_supplementary_docs |
| REQ-DDB-PIPE-014 | measured | test_the_dotmarkdown_spelling_counts → ingest_supplementary_docs → within_repo |
Source · 12 lines
def test_the_dotmarkdown_spelling_counts(tmp_path: Path) -> None:
"""@brief `.markdown` is markdown. @version 1"""
root = tmp_path / "repo"
_write(root, "notes.markdown", "# Notes\n\nBody.\n")
db = tmp_path / "clew.db"
db.touch()
ingest_supplementary_docs(db, root, files=["notes.markdown"])
assert _ingested(db) == {"notes.markdown"}
Activity · 6 steps
test_the_named_globs_still_hold_when_no_file_set_is_given
None test_prose_markdown_coverage.test_the_named_globs_still_hold_when_no_file_set_is_given(Path tmp_path)
A caller passing no file set gets the previous behaviour.
tests/test_prose_markdown_coverage.py:105
Checks
assert _ingested(db) == {"README", "CONTRIBUTING.md"}
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-INDEX-002 | measured | test_the_named_globs_still_hold_when_no_file_set_is_given → ingest_supplementary_docs → _ingest_one_doc_file → memoized |
| REQ-DDB-PIPE-001 | measured | test_the_named_globs_still_hold_when_no_file_set_is_given → ingest_supplementary_docs |
| REQ-DDB-PIPE-014 | measured | test_the_named_globs_still_hold_when_no_file_set_is_given → ingest_supplementary_docs → within_repo |
Source · 18 lines
def test_the_named_globs_still_hold_when_no_file_set_is_given(tmp_path: Path) -> None:
"""Back-compat, and the reason the glob list is kept: `README` with no extension and
`README.rst` are prose that no markdown rule would find.
@brief A caller passing no file set gets the previous behaviour. @version 1
"""
root = tmp_path / "repo"
_write(root, "README", "# Plain\n\nNo extension.\n")
_write(root, "CONTRIBUTING.md", "# Contributing\n\nHow.\n")
_write(root, "src/notes.md", "# Notes\n\nNot named by any glob.\n")
db = tmp_path / "clew.db"
db.touch()
ingest_supplementary_docs(db, root)
assert _ingested(db) == {"README", "CONTRIBUTING.md"}