test(description): a spec point a YAML reader cannot read verbatim is not written
Red first. Measured on the first R761 build fromde7849e: 217 of the 2 024 descriptions carry ": ", and PyYAML's safe_load refused exactly those 217 concepts' frontmatter -- the same document's frontmatter parsed without them (1 of 2 761 refused before the key existed, on a title). Quoting would write a value the line-oriented readers here return with its quotes; cleaning would write a sentence the source does not carry. A colon with no space after it is an ordinary character and stays. 1 of 12 red onde7849e: the ": " description is written. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
de7849e35b
commit
31ffc2c3d6
1 changed files with 26 additions and 0 deletions
|
|
@ -103,6 +103,32 @@ def test_the_description_reaches_the_concept_only_where_the_source_has_one(
|
|||
assert {title: values.get("description") for title, values in concepts.items()} == EXPECTED
|
||||
|
||||
|
||||
def test_a_spec_point_a_yaml_reader_could_not_read_verbatim_is_not_written(
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Verbatim or not at all, as for the `sources` title.
|
||||
|
||||
MEASURED ON R761: 217 of the 2 024 descriptions the first build wrote carry
|
||||
`": "`, and a YAML reader refuses `description: a: b` -- PyYAML's
|
||||
`safe_load` rejected exactly those 217 concepts' frontmatter, which the
|
||||
same document's frontmatter had parsed without before the key existed.
|
||||
Quoting would write a value the line-oriented readers here return WITH its
|
||||
quotes, and cleaning would write a sentence the source does not carry. A
|
||||
colon with no space after it is an ordinary character and stays.
|
||||
"""
|
||||
data = (
|
||||
IDENTITY.read_bytes()
|
||||
.replace(b"Omfatter maling av rekkverk.", b"Omfatter maling: rekkverk og gjerder.")
|
||||
.replace(b"Omfatter utskifting av skadde", b"Omfatter 1:2 utskifting av skadde")
|
||||
)
|
||||
concepts = _by_title(_build(tmp_path, IDENTITY.name, data))
|
||||
|
||||
assert "description" not in concepts["Maling av rekkverk"]
|
||||
assert concepts["Utskifting av enkeltkomponenter"]["description"] == FIRST.replace(
|
||||
"Omfatter utskifting", "Omfatter 1:2 utskifting"
|
||||
)
|
||||
|
||||
|
||||
def test_a_type_that_declares_no_spec_point_gets_no_description(tmp_path: Path) -> None:
|
||||
markdown = b"# Innledning\n\na) Omfatter noe.\n\n# Omfang\n\nMer tekst her.\n"
|
||||
concepts = _by_title(_build(tmp_path, "notat.md", markdown))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue