| 1 | """The paragraph headline phrase is report structure, not a formatting default.""" |
| 2 | |
| 3 | from tests.skill_contract import reference_text, root_text |
| 4 | |
| 5 | |
| 6 | GENERAL_PREFERENCE = "general style preference alone does not remove it" |
| 7 | |
| 8 | |
| 9 | def _output_contract_intro(): |
| 10 | section = root_text().split("## Output contract\n", 1)[1] |
| 11 | return section.split("**BADGE", 1)[0] |
| 12 | |
| 13 | |
| 14 | def _law(number): |
| 15 | text = root_text() |
| 16 | return text.split(f"**LAW {number} -", 1)[1].split(f"**LAW {number + 1} -", 1)[0] |
| 17 | |
| 18 | |
| 19 | def _synthesis_headline_rule(): |
| 20 | marker = "**MANDATORY - bold headline per narrative paragraph.**" |
| 21 | text = reference_text("synthesis") |
| 22 | assert marker in text |
| 23 | return text.split(marker, 1)[1].splitlines()[0] |
| 24 | |
| 25 | |
| 26 | def test_root_contract_names_the_three_cases_that_remove_the_headline(): |
| 27 | intro = _output_contract_intro() |
| 28 | assert "headline phrase is report structure" in intro |
| 29 | assert "naming this report or arriving with the request" in intro |
| 30 | assert "a host or operator requirement" in intro |
| 31 | assert "a channel that does not render markdown" in intro |
| 32 | |
| 33 | |
| 34 | def test_general_style_preference_alone_keeps_the_headline(): |
| 35 | assert GENERAL_PREFERENCE in _output_contract_intro() |
| 36 | assert GENERAL_PREFERENCE in _synthesis_headline_rule() |
| 37 | |
| 38 | |
| 39 | def test_user_preference_sentence_is_qualified_by_the_structure_rule(): |
| 40 | intro = _output_contract_intro() |
| 41 | preference = "User formatting preferences, including host memory, take precedence" |
| 42 | assert preference in intro |
| 43 | following = intro.split(preference, 1)[1] |
| 44 | assert following.lstrip(" .").startswith("The paragraph headline phrase is report structure") |
| 45 | |
| 46 | |
| 47 | def test_root_laws_and_self_check_do_not_make_the_headline_a_formatting_default(): |
| 48 | law2 = _law(2) |
| 49 | assert "lead-ins where governing formatting permits" not in law2 |
| 50 | assert "headline phrases are structure" in law2 |
| 51 | assert "bold-lead-in paragraphs" in _law(4) |
| 52 | self_check = root_text().split("## PRE-PRESENT SELF-CHECK", 1)[1].split("\n1. ", 1)[0] |
| 53 | assert "Skip a conflicting presentation default" in self_check |
| 54 | assert "headline phrases are structure" in self_check |
| 55 | |
| 56 | |
| 57 | def test_synthesis_agrees_with_the_root_contract(): |
| 58 | rule = _synthesis_headline_rule() |
| 59 | assert "report structure" in rule |
| 60 | assert "root output contract" in rule |
| 61 | opening = reference_text("synthesis").split("\n## ", 1)[0] |
| 62 | assert "Follow governing host/tool and user instructions before these presentation defaults" in opening |
| 63 |