test(fixtures): replace sector-specific example material with generic, fictitious examples — green
Every fixture, test document, tool example and document now uses an invented kitchen-and-baking handbook series, written in this repository. The package's behaviour is unchanged; src/ changes are comments and help text only. - Generated fixtures are regenerated from their generators. Their structural counts are identical before and after: elements, images, rows, cells, headings, bookmarks and the witness inventory's per-document totals. The image-inbox and accounting documents are renamed kapittel-84-*. - tools/okf_accounting_gate.py: the two options that named one real corpus each are replaced by a generic, repeatable --corpus PATH with no default. Row 5 compares the PDF pair alone. Gate verdict unchanged: RED rows 2, 3, 6. - tools/okf_witness.py: the STS JSON reader for one publisher's delivery is removed, along with its three twins and five tests. The mutation harness loses W09. - docs/: 13 dated reports that documented runs on a retired reference corpus are removed, and 40 are neutralized. Dead links are removed, and no new dangling path is introduced. - The synthetic MCP-gate corpus and the residual probe words are neutral. Valgt: keep the `okf quality --fasit` bar value (the measured fraction, one corpus) and rewrite only its provenance, because the verdict stays unchanged and the number names nothing. Term check with the local list: 0 of 411 tracked files, 0 file names, 0 of 27 binary fixtures. Suite after git add: 2457 passed, 1 skipped. The base tree had 2460 passed and 2 skipped; five tests went with the JSON reader and four were added by the term check. ruff, ruff format and mypy --strict src/ are clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
1e7345a401
commit
9d1f4b14ed
174 changed files with 1889 additions and 6512 deletions
|
|
@ -48,7 +48,7 @@ GENERIC = FIXTURES / "generic-feed.xml"
|
|||
# document inside it.
|
||||
OPAQUE = "0f1e2d3c-4b5a-6978-8796-a5b4c3d2e1f0.xml"
|
||||
|
||||
FULL_TITLE = "R900 Testnormalen Standard for fiksturer, tester og kontroll"
|
||||
FULL_TITLE = "P900 Testnormalen Standard for fiksturer, tester og kontroll"
|
||||
|
||||
|
||||
def _build(tmp_path: Path, files: dict[str, bytes]) -> Path:
|
||||
|
|
@ -82,7 +82,7 @@ def test_the_identity_is_read_from_the_documents_own_elements() -> None:
|
|||
identity = extract.declared_identity(IDENTITY.name, IDENTITY.read_bytes())
|
||||
|
||||
assert identity == extract.DeclaredIdentity(
|
||||
doc_number="R900 Testnormalen", year="2024", title=FULL_TITLE
|
||||
doc_number="P900 Testnormalen", year="2024", title=FULL_TITLE
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -101,7 +101,7 @@ def test_a_document_declaring_neither_has_no_identity(fixture: Path) -> None:
|
|||
|
||||
def test_only_the_row_that_can_read_a_declaration_is_asked() -> None:
|
||||
"""A markdown file whose text LOOKS like an identity declares nothing."""
|
||||
data = b"<std-ident><doc-number>R900 Testnormalen</doc-number></std-ident>\n"
|
||||
data = b"<std-ident><doc-number>P900 Testnormalen</doc-number></std-ident>\n"
|
||||
assert extract.declared_identity("notat.md", data) is None
|
||||
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ def test_the_doc_number_names_the_document_directory(tmp_path: Path) -> None:
|
|||
concepts = _concepts(_build(tmp_path, {OPAQUE: IDENTITY.read_bytes()}))
|
||||
|
||||
assert concepts, "the fixture must produce concepts for this to mean anything"
|
||||
assert all(name.startswith("r900-testnormalen/") for name in concepts), sorted(concepts)
|
||||
assert all(name.startswith("p900-testnormalen/") for name in concepts), sorted(concepts)
|
||||
assert not any(Path(OPAQUE).stem in name for name in concepts)
|
||||
|
||||
|
||||
|
|
@ -143,16 +143,16 @@ def test_the_address_keeps_the_file_and_the_title_is_the_documents(tmp_path: Pat
|
|||
concepts = _concepts(_build(tmp_path, {OPAQUE: IDENTITY.read_bytes()}))
|
||||
|
||||
assert {values["sources"] for values in concepts.values()} == {
|
||||
_sources(OPAQUE, "R900 Testnormalen 2024")
|
||||
_sources(OPAQUE, "P900 Testnormalen 2024")
|
||||
}
|
||||
|
||||
|
||||
def test_a_nested_document_keeps_the_folders_above_it(tmp_path: Path) -> None:
|
||||
concepts = _concepts(_build(tmp_path, {f"leveranse/{OPAQUE}": IDENTITY.read_bytes()}))
|
||||
|
||||
assert all(name.startswith("leveranse/r900-testnormalen/") for name in concepts)
|
||||
assert all(name.startswith("leveranse/p900-testnormalen/") for name in concepts)
|
||||
assert {values["sources"] for values in concepts.values()} == {
|
||||
_sources(f"leveranse/{OPAQUE}", "R900 Testnormalen 2024")
|
||||
_sources(f"leveranse/{OPAQUE}", "P900 Testnormalen 2024")
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -204,13 +204,13 @@ def test_two_documents_declaring_one_doc_number_both_keep_their_file_name(
|
|||
bundle = _build(tmp_path, {"a.xml": IDENTITY.read_bytes(), "b.xml": second})
|
||||
concepts = _concepts(bundle)
|
||||
|
||||
assert not any(name.startswith("r900-testnormalen/") for name in concepts)
|
||||
assert not any(name.startswith("p900-testnormalen/") for name in concepts)
|
||||
assert {name.split("/", 1)[0] for name in concepts} == {"a", "b"}
|
||||
# Every section of both documents landed: same sections, two directories.
|
||||
assert sum(name.startswith("a/") for name in concepts) == sum(
|
||||
name.startswith("b/") for name in concepts
|
||||
)
|
||||
assert "R900 Testnormalen" in capsys.readouterr().err
|
||||
assert "P900 Testnormalen" in capsys.readouterr().err
|
||||
|
||||
|
||||
def test_a_declared_name_another_documents_file_name_holds_is_not_taken(
|
||||
|
|
@ -218,13 +218,13 @@ def test_a_declared_name_another_documents_file_name_holds_is_not_taken(
|
|||
) -> None:
|
||||
markdown = b"# Innledning\n\nTekst her.\n\n# Omfang\n\nMer tekst her.\n"
|
||||
concepts = _concepts(
|
||||
_build(tmp_path, {"r900-testnormalen.md": markdown, OPAQUE: IDENTITY.read_bytes()})
|
||||
_build(tmp_path, {"p900-testnormalen.md": markdown, OPAQUE: IDENTITY.read_bytes()})
|
||||
)
|
||||
|
||||
stems = {name.split("/", 1)[0] for name in concepts}
|
||||
assert stems == {"r900-testnormalen", Path(OPAQUE).stem}
|
||||
assert stems == {"p900-testnormalen", Path(OPAQUE).stem}
|
||||
assert all(
|
||||
values["source_file"] == "r900-testnormalen.md"
|
||||
values["source_file"] == "p900-testnormalen.md"
|
||||
for name, values in concepts.items()
|
||||
if name.startswith("r900-testnormalen/")
|
||||
if name.startswith("p900-testnormalen/")
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue