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
tests/fixtures/make_image_fixtures.py
vendored
48
tests/fixtures/make_image_fixtures.py
vendored
|
|
@ -58,8 +58,8 @@ def jpeg_header(width: int, height: int) -> bytes:
|
|||
|
||||
Not a decodable photograph, and that is the point of it. The `pdf` reader
|
||||
passes `DCTDecode` bytes through untouched and reads only the frame header
|
||||
for the size, which is precisely what R761's own table images need -- 29 of
|
||||
its 50 image objects are `DCTDecode`. A fixture that also carried entropy
|
||||
for the size, which is precisely what a real reference PDF's table images
|
||||
need -- 29 of its 50 image objects are `DCTDecode`. A fixture that also carried entropy
|
||||
data would exercise no additional line of this package and could not be read
|
||||
byte by byte by a person.
|
||||
"""
|
||||
|
|
@ -77,7 +77,7 @@ def jpeg_header(width: int, height: int) -> bytes:
|
|||
# --- pdf ---------------------------------------------------------------------
|
||||
#
|
||||
# TWO images on one page, and they are deliberately of the two kinds the
|
||||
# measurement on R761 found: 29 `DCTDecode` objects, which arrive as a finished
|
||||
# measurement on a reference PDF found: 29 `DCTDecode` objects, which arrive as a finished
|
||||
# JPEG file, and 21 `FlateDecode` ones, which arrive as raw samples with the
|
||||
# colour model in the dictionary beside them and have to be encoded to be
|
||||
# carried at all. A fixture with only one kind would leave half the reader
|
||||
|
|
@ -88,7 +88,7 @@ PDF_GRAY_SAMPLES = bytes([0, 60, 120, 180, 20, 80, 140, 200, 40, 100, 160, 255])
|
|||
PDF_JPEG_WIDTH, PDF_JPEG_HEIGHT = 360, 269
|
||||
|
||||
PDF_CONTENT = (
|
||||
b"BT /F1 12 Tf 20 170 Td (Toleranseklasse er gitt i tabell 84-2) Tj ET\n"
|
||||
b"BT /F1 12 Tf 20 170 Td (Hevetidsklasse er gitt i tabell 84-2) Tj ET\n"
|
||||
b"q 80 0 0 60 20 90 cm /ImFlate Do Q\n"
|
||||
b"q 80 0 0 60 20 20 cm /ImJpeg Do Q\n"
|
||||
)
|
||||
|
|
@ -153,11 +153,11 @@ def build_image_pdf() -> bytes:
|
|||
# the gate counts it as found-and-not-carried rather than as absent.
|
||||
|
||||
HTML_DOCUMENT = """<!doctype html>
|
||||
<html><head><title>Prosess 84</title></head>
|
||||
<html><head><title>Kapittel 84</title></head>
|
||||
<body>
|
||||
<h1>84 Konstruksjoner av betong</h1>
|
||||
<p>Toleranseklasse for de enkelte konstruksjonsdeler er gitt i tabell 84-2.</p>
|
||||
<img src="graphics/tabell-84-2.png" alt="Tabell 84-2 Toleranseklasser">
|
||||
<h1>84 Brød og boller</h1>
|
||||
<p>Hevetidsklasse for de enkelte deigtyper er gitt i tabell 84-2.</p>
|
||||
<img src="graphics/tabell-84-2.png" alt="Tabell 84-2 Hevetidsklasser">
|
||||
<p>Figuren under viser prinsippet.</p>
|
||||
<figure>
|
||||
<img src="graphics/figur-84-1.png" alt="Figur 84-1 Prinsippskisse">
|
||||
|
|
@ -170,7 +170,7 @@ HTML_DOCUMENT = """<!doctype html>
|
|||
|
||||
# --- niso-sts ----------------------------------------------------------------
|
||||
#
|
||||
# The shape the R761 delivery actually has, measured 2026-09-16: 50 `<graphic>`
|
||||
# The shape a real NISO-STS delivery has, measured 2026-09-16: 50 `<graphic>`
|
||||
# elements, every one a direct child of a `<sec>`, none inside a `<table-wrap>`,
|
||||
# each carrying a bare file name in `xlink:href` that resolves against a sibling
|
||||
# `graphics/` directory. No `<caption>` anywhere near them -- the caption a
|
||||
|
|
@ -178,15 +178,15 @@ HTML_DOCUMENT = """<!doctype html>
|
|||
|
||||
STS_DOCUMENT = """<?xml version="1.0" encoding="UTF-8"?>
|
||||
<standard xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<front><std-ident><doc-number>R761</doc-number></std-ident></front>
|
||||
<front><std-ident><doc-number>P761</doc-number></std-ident></front>
|
||||
<body>
|
||||
<sec>
|
||||
<label>84</label>
|
||||
<title>Konstruksjoner av betong</title>
|
||||
<title>Brød og boller</title>
|
||||
<sec>
|
||||
<label>84.1</label>
|
||||
<title>Toleranser</title>
|
||||
<p>Toleranseklasse er gitt i tabell 84-2.</p>
|
||||
<title>Hevetider</title>
|
||||
<p>Hevetidsklasse er gitt i tabell 84-2.</p>
|
||||
<graphic xlink:href="graphics/tabell-84-2.png"/>
|
||||
<p>Figur 84-1 viser prinsippet.</p>
|
||||
<graphic xlink:href="figur-84-1.png"/>
|
||||
|
|
@ -225,18 +225,18 @@ def build_docx() -> bytes:
|
|||
+ ' xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"'
|
||||
+ ' xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"'
|
||||
+ ' xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"><w:body>'
|
||||
+ "<w:p><w:r><w:t>Toleranseklasse er gitt i tabell 84-2.</w:t></w:r></w:p>"
|
||||
+ "<w:p><w:r><w:t>Hevetidsklasse er gitt i tabell 84-2.</w:t></w:r></w:p>"
|
||||
+ '<w:p><w:r><w:drawing><wp:inline><wp:extent cx="381000" cy="285750"/>'
|
||||
+ '<wp:docPr id="1" name="Bilde 1" descr="Tabell 84-2 Toleranseklasser"/>'
|
||||
+ '<wp:docPr id="1" name="Bilde 1" descr="Tabell 84-2 Hevetidsklasser"/>'
|
||||
+ '<a:graphic><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006'
|
||||
+ '/picture"><pic:pic><pic:nvPicPr><pic:cNvPr id="1" name="tabell-84-2.png"'
|
||||
+ ' descr="Tabell 84-2 Toleranseklasser"/><pic:cNvPicPr/></pic:nvPicPr>'
|
||||
+ ' descr="Tabell 84-2 Hevetidsklasser"/><pic:cNvPicPr/></pic:nvPicPr>'
|
||||
+ '<pic:blipFill><a:blip r:embed="rIdImg"/><a:stretch><a:fillRect/></a:stretch>'
|
||||
+ '</pic:blipFill><pic:spPr><a:xfrm><a:off x="0" y="0"/>'
|
||||
+ '<a:ext cx="381000" cy="285750"/></a:xfrm>'
|
||||
+ '<a:prstGeom prst="rect"><a:avLst/></a:prstGeom></pic:spPr></pic:pic>'
|
||||
+ "</a:graphicData></a:graphic></wp:inline></w:drawing></w:r></w:p>"
|
||||
+ "<w:p><w:r><w:t>Etter tabellen gjelder NS-EN 13670.</w:t></w:r></w:p>"
|
||||
+ "<w:p><w:r><w:t>Etter tabellen kommer steketidene.</w:t></w:r></w:p>"
|
||||
+ "</w:body></w:document>",
|
||||
}
|
||||
return build_container(parts)
|
||||
|
|
@ -283,7 +283,7 @@ def build_pptx() -> bytes:
|
|||
+ "<p:grpSpPr/>"
|
||||
+ '<p:sp><p:nvSpPr><p:cNvPr id="2" name="Tittel 1"/><p:cNvSpPr/>'
|
||||
+ '<p:nvPr><p:ph type="title"/></p:nvPr></p:nvSpPr><p:spPr/>'
|
||||
+ "<p:txBody><a:bodyPr/><a:p><a:r><a:t>Toleranser</a:t></a:r></a:p></p:txBody></p:sp>"
|
||||
+ "<p:txBody><a:bodyPr/><a:p><a:r><a:t>Hevetider</a:t></a:r></a:p></p:txBody></p:sp>"
|
||||
+ '<p:pic><p:nvPicPr><p:cNvPr id="3" name="skisse.png" descr="Prinsippskisse"/>'
|
||||
+ "<p:cNvPicPr/><p:nvPr/></p:nvPicPr>"
|
||||
+ '<p:blipFill><a:blip r:embed="rIdImg"/><a:stretch><a:fillRect/></a:stretch>'
|
||||
|
|
@ -310,17 +310,17 @@ if __name__ == "__main__":
|
|||
|
||||
# FIVE DISTINCT STEMS. One stem across five extensions is refused by the
|
||||
# door's own SS 3 collision rule -- measured while building this fixture:
|
||||
# `prosess-84.{pdf,docx,pptx}` gave `inbox_slug_collision: 2/7` and two of
|
||||
# `kapittel-84.{pdf,docx,pptx}` gave `inbox_slug_collision: 2/7` and two of
|
||||
# the five readers were never exercised at all, with the gate reporting a
|
||||
# carrying defect that was really a fixture defect.
|
||||
written: list[tuple[str, bytes]] = [
|
||||
("graphics/tabell-84-2.png", png(120, 90, value=0x20)),
|
||||
("graphics/figur-84-1.png", png(64, 48, value=0x80)),
|
||||
("prosess-84-web.html", HTML_DOCUMENT.encode("utf-8")),
|
||||
("prosess-84-sts.xml", STS_DOCUMENT.encode("utf-8")),
|
||||
("prosess-84-tabell.pdf", build_image_pdf()),
|
||||
("prosess-84-notat.docx", build_docx()),
|
||||
("prosess-84-presentasjon.pptx", build_pptx()),
|
||||
("kapittel-84-web.html", HTML_DOCUMENT.encode("utf-8")),
|
||||
("kapittel-84-sts.xml", STS_DOCUMENT.encode("utf-8")),
|
||||
("kapittel-84-tabell.pdf", build_image_pdf()),
|
||||
("kapittel-84-notat.docx", build_docx()),
|
||||
("kapittel-84-presentasjon.pptx", build_pptx()),
|
||||
]
|
||||
for name, payload in written:
|
||||
(IMAGES / name).write_bytes(payload)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue