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
|
|
@ -23,7 +23,7 @@ Three readers must agree on every value written, each for its own reason:
|
|||
|
||||
MEASURED before any code moved (PyYAML 6.0.3): the K2 default bundle this
|
||||
repository pins fails `safe_load` on 41 of its 455 frontmatter blocks, every
|
||||
one a `title` (a leading `- `, `**` or `*`, a `": "`), and the R761 build on 1
|
||||
one a `title` (a leading `- `, `**` or `*`, a `": "`), and the reference-standard build on 1
|
||||
of 2 763 (a title ending in `:`). No `sources` value okf itself wrote failed.
|
||||
"""
|
||||
|
||||
|
|
@ -97,11 +97,11 @@ def _concept(title: str, **overrides: object) -> str:
|
|||
#: Plain today and plain after: a colon with no space, a `#` with no space
|
||||
#: before it, `=`, `&`. Written byte-for-byte as before -- the known-negative
|
||||
#: that keeps the fix from quoting what never needed it.
|
||||
BLOCK_PLAIN = ["N100:2023", "Kap#3", "R761 Prosesskoden:2025", "a=b&c", "1:2 utskifting"]
|
||||
BLOCK_PLAIN = ["Q100:2023", "Kap#3", "P761 Oppskriftsboka:2025", "a=b&c", "1:2 utskifting"]
|
||||
|
||||
#: Each is refused or MISREAD by PyYAML as a plain block scalar.
|
||||
BLOCK_NOT_PLAIN = [
|
||||
"N100: 2023",
|
||||
"Q100: 2023",
|
||||
"Kap #3",
|
||||
"Eksempel kontur:",
|
||||
"- punkt",
|
||||
|
|
@ -147,7 +147,7 @@ def test_a_run_stated_description_with_a_colon_space_reads_back(tmp_path: Path)
|
|||
"""K3-19's 217: a DERIVED spec point carrying `": "` is still omitted
|
||||
(`test_sts_description.py`); a STATED one is the caller's words and is
|
||||
written in a form a YAML reader returns verbatim."""
|
||||
value = "Omfatter maling: rekkverk og gjerder."
|
||||
value = "Omfatter maling: gelender og gjerder."
|
||||
text = _concept(
|
||||
"T", profile=SEGMENTED_OKF_V0_2, concept_frontmatter_values={"description": value}
|
||||
)
|
||||
|
|
@ -157,11 +157,11 @@ def test_a_run_stated_description_with_a_colon_space_reads_back(tmp_path: Path)
|
|||
# --- the `sources` flow mapping ---------------------------------------------
|
||||
|
||||
#: Written verbatim inside the flow mapping, and every reader agrees.
|
||||
FLOW_KEPT = ["N100:2023", "R761 Prosesskoden 2025", "Kap#3", "a=b&c"]
|
||||
FLOW_KEPT = ["Q100:2023", "P761 Oppskriftsboka 2025", "Kap#3", "a=b&c"]
|
||||
|
||||
#: No form both PyYAML and the guard read: plain, PyYAML refuses or misreads
|
||||
#: it; quoted, the guard refuses it. Refused rather than written.
|
||||
FLOW_REFUSED = ["N100: 2023", "Kap #3", "slutt:", "a?b", "Vegvesen's", 'Sa "hei"', "*x", "a, b"]
|
||||
FLOW_REFUSED = ["Q100: 2023", "Kap #3", "slutt:", "a?b", "Forlaget's", 'Sa "hei"', "*x", "a, b"]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("title", FLOW_KEPT)
|
||||
|
|
@ -206,7 +206,7 @@ def test_a_run_stated_sources_with_a_query_string_is_refused() -> None:
|
|||
|
||||
|
||||
def test_a_run_stated_sources_without_one_is_written_verbatim(tmp_path: Path) -> None:
|
||||
stated = "[{ resource: https://h.no/api/1, title: N100:2023 }]"
|
||||
stated = "[{ resource: https://h.no/api/1, title: Q100:2023 }]"
|
||||
text = _concept("T", profile=SEGMENTED_OKF_V0_2, concept_frontmatter_values={"sources": stated})
|
||||
assert f"\nsources: {stated}\n" in text
|
||||
_assert_every_reader_agrees(text, tmp_path)
|
||||
|
|
@ -221,8 +221,8 @@ def test_door_a_refuses_a_locator_no_reader_pair_can_share(root: str) -> None:
|
|||
|
||||
# --- the readers read both forms ---------------------------------------------
|
||||
|
||||
QUOTED = '---\ntitle: "N100: 2023 \\"sitat\\" C:\\\\mappe"\nprosessnr: \'1\'\n---\n\nBody.\n'
|
||||
UNQUOTED_TITLE = 'N100: 2023 "sitat" C:\\mappe'
|
||||
QUOTED = '---\ntitle: "Q100: 2023 \\"sitat\\" C:\\\\mappe"\nprosessnr: \'1\'\n---\n\nBody.\n'
|
||||
UNQUOTED_TITLE = 'Q100: 2023 "sitat" C:\\mappe'
|
||||
|
||||
|
||||
def test_every_flat_reader_unquotes_a_double_quoted_value(tmp_path: Path) -> None:
|
||||
|
|
@ -251,14 +251,14 @@ def test_read_sources_unquotes_in_both_yaml_forms() -> None:
|
|||
block = [
|
||||
"sources:",
|
||||
' - resource: "https://h.no/api/1?languageCode=nb"',
|
||||
' title: "N100: 2023"',
|
||||
' title: "Q100: 2023"',
|
||||
]
|
||||
flow = ['sources: [{ resource: "https://h.no/a?x=1, y", title: "N100: 2023" }]']
|
||||
flow = ['sources: [{ resource: "https://h.no/a?x=1, y", title: "Q100: 2023" }]']
|
||||
assert read_sources(block)[0] == (
|
||||
{"resource": "https://h.no/api/1?languageCode=nb", "title": "N100: 2023"},
|
||||
{"resource": "https://h.no/api/1?languageCode=nb", "title": "Q100: 2023"},
|
||||
)
|
||||
# A quoted comma is part of the value, not an entry separator.
|
||||
assert read_sources(flow)[0] == ({"resource": "https://h.no/a?x=1, y", "title": "N100: 2023"},)
|
||||
assert read_sources(flow)[0] == ({"resource": "https://h.no/a?x=1, y", "title": "Q100: 2023"},)
|
||||
|
||||
|
||||
def _strip_only(path: Path) -> dict[str, str]:
|
||||
|
|
@ -321,7 +321,7 @@ CONSTRUCTED = [
|
|||
"a{b}c",
|
||||
"tab\there",
|
||||
"slutt :",
|
||||
"Statens vegvesen",
|
||||
"Forlagets kokebok",
|
||||
"100 %",
|
||||
]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue