Files
odysseus/tests/test_readme_ascii_fenced.py
T
Kenny Van de Maele 1747c13133 test: align README presentation guards with the #4306 refresh (#4311)
* test: align README presentation guards with the #4306 refresh

The 'Refresh README presentation' change (#4306) swapped the ASCII banner
for a centered wordmark image and moved the native quickstart into
docs/setup.md, which left four base tests failing on dev and froze the
merge gate:

- test_security_regressions::test_readme_native_quickstart_uses_loopback
  now also accepts the loopback guidance from docs/setup.md, where the
  quickstart moved (no behaviour change; the guidance is intact there).
- test_readme_ascii_fenced guards the new wordmark title instead of the
  removed ASCII banner, and keeps a defensive check that any reintroduced
  box-drawing banner stays inside a code fence (the original #1390 mode).
- The five unreferenced demo gifs under docs/ (chat, compare, document,
  notes, research) are removed so test_docs_no_orphan_images passes; they
  were de-referenced by the refresh. Recoverable from history if a docs
  page wants to embed them again.

* chore: refresh PR checks

---------

Co-authored-by: Alexandre Teixeira <alexandremagteixeira@gmail.com>
2026-06-15 16:25:38 +01:00

40 lines
1.7 KiB
Python

"""Regression guard for the README title presentation.
Originally (#1390) the README opened with an ASCII-art banner that had to live
inside a ``` code fence, otherwise GitHub's markdown collapsed its leading
whitespace and box-drawing rules and rendered it misaligned. The README refresh
(#4306) dropped that banner in favour of a centered wordmark image, so the guard
now pins the wordmark identity instead, while still catching the original failure
mode if an un-fenced ASCII banner is ever reintroduced.
"""
from pathlib import Path
README = Path(__file__).resolve().parent.parent / "README.md"
# Box-drawing rule from the legacy ASCII banner (the #1390 failure mode).
_RULE = "" * 10
def _fenced_segments(text: str):
"""Return the segments of *text* that sit INSIDE ``` fences."""
parts = text.split("```")
# parts[0] is before the first fence, parts[1] is inside the first fence, ...
return parts[1::2]
def test_readme_opens_with_wordmark_title():
# The README must still open with a recognizable Odysseus title: now the
# centered wordmark image rather than an H1 / ASCII banner.
head = "\n".join(README.read_text(encoding="utf-8").splitlines()[:15])
assert 'alt="Odysseus"' in head, "README must open with the Odysseus wordmark image"
def test_reintroduced_ascii_banner_stays_fenced():
# Defensive: if a box-drawing banner is ever added back, it must be fenced so
# GitHub renders it monospace-as-typed (the original #1390 regression).
text = README.read_text(encoding="utf-8")
if _RULE not in text:
return
inside = "\n".join(_fenced_segments(text))
assert _RULE in inside, "ASCII banner rule must be inside a ``` code fence"