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

requirementlinkedpath to the implementer
REQ-DDB-INDEX-002measuredtest_a_file_both_a_glob_and_the_scan_name_is_ingested_once → ingest_supplementary_docs → _ingest_one_doc_file → memoized
REQ-DDB-PIPE-001measuredtest_a_file_both_a_glob_and_the_scan_name_is_ingested_once → ingest_supplementary_docs
REQ-DDB-PIPE-014measuredtest_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"], headings

1 more lines, not shown

Activity · 9 steps
lines 132–132root = tmp_path / "repo"lines 133–133_write(root, "README.md", "# Repo\n\nTop.\n\n## One\n\nA.\n")lines 134–134db = tmp_path / "clew.db"lines 135–135db.touch()lines 137–137ingest_supplementary_docs(db, root, files=["README.md"])lines 139–139conn = sqlite3.connect(str(db))lines 140–140trylines 141–141headings = [r[0] for r in conn.execute("SELECT heading FROM supplementary_docs")]lines 144–144assert sorted(headings) == ["One", "Repo"], headings

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

Show on the map →

Called by none

Calls _ingested, _write, ingest_supplementary_docs

Checks

  • assert _ingested(db) == {

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-002measuredtest_a_markdown_file_the_old_globs_never_named_is_ingested → ingest_supplementary_docs → _ingest_one_doc_file → memoized
REQ-DDB-PIPE-001measuredtest_a_markdown_file_the_old_globs_never_named_is_ingested → ingest_supplementary_docs
REQ-DDB-PIPE-014measuredtest_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
lines 56–56root = tmp_path / "repo"lines 57–57_write(root, "README.md", "# Repo\n\nTop level.\n")lines 58–58_write(root, "src/notes.md", "# Notes\n\nWhy the cache keys on content.\n")lines 59–59_write(root, "architecture/decisions/0003-split.md", "# ADR 3\n\nSplit the index.\n")lines 60–60db = tmp_path / "clew.db"lines 61–61db.touch()lines 63–67ingest_supplementary_docs( db, root, files=["README.md", "src/notes.md", "architecture/decisions/0003-split.md"], )lines 69–73assert _ingested(db) == { "README.md", "src/notes.md", "architecture/decisions/0003-split.md", }

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

Show on the map →

Called by none

Calls _ingested, _write, ingest_supplementary_docs

Checks

  • assert _ingested(db) == {"docs/design.md"}

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-002measuredtest_markdown_outside_the_scanned_set_is_not_ingested → ingest_supplementary_docs → _ingest_one_doc_file → memoized
REQ-DDB-PIPE-001measuredtest_markdown_outside_the_scanned_set_is_not_ingested → ingest_supplementary_docs
REQ-DDB-PIPE-014measuredtest_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
lines 82–82root = tmp_path / "repo"lines 83–83_write(root, "docs/design.md", "# Design\n\nOurs.\n")lines 84–84_write(root, "node_modules/left-pad/README.md", "# left-pad\n\nTheirs.\n")lines 85–85db = tmp_path / "clew.db"lines 86–86db.touch()lines 88–88ingest_supplementary_docs(db, root, files=["docs/design.md"])lines 90–90assert _ingested(db) == {"docs/design.md"}

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

Show on the map →

Called by none

Calls _ingested, _write, ingest_supplementary_docs

Checks

  • assert _ingested(db) == {"notes.markdown"}

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-002measuredtest_the_dotmarkdown_spelling_counts → ingest_supplementary_docs → _ingest_one_doc_file → memoized
REQ-DDB-PIPE-001measuredtest_the_dotmarkdown_spelling_counts → ingest_supplementary_docs
REQ-DDB-PIPE-014measuredtest_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
lines 95–95root = tmp_path / "repo"lines 96–96_write(root, "notes.markdown", "# Notes\n\nBody.\n")lines 97–97db = tmp_path / "clew.db"lines 98–98db.touch()lines 100–100ingest_supplementary_docs(db, root, files=["notes.markdown"])lines 102–102assert _ingested(db) == {"notes.markdown"}

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

Show on the map →

Called by none

Calls _ingested, _write, ingest_supplementary_docs

Checks

  • assert _ingested(db) == {"README", "CONTRIBUTING.md"}

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-002measuredtest_the_named_globs_still_hold_when_no_file_set_is_given → ingest_supplementary_docs → _ingest_one_doc_file → memoized
REQ-DDB-PIPE-001measuredtest_the_named_globs_still_hold_when_no_file_set_is_given → ingest_supplementary_docs
REQ-DDB-PIPE-014measuredtest_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"}

Activity · 8 steps
lines 111–111root = tmp_path / "repo"lines 112–112_write(root, "README", "# Plain\n\nNo extension.\n")lines 113–113_write(root, "CONTRIBUTING.md", "# Contributing\n\nHow.\n")lines 114–114_write(root, "src/notes.md", "# Notes\n\nNot named by any glob.\n")lines 115–115db = tmp_path / "clew.db"lines 116–116db.touch()lines 118–118ingest_supplementary_docs(db, root)lines 120–120assert _ingested(db) == {"README", "CONTRIBUTING.md"}