From b305167a95f7fbbad35810a54b5ae964bdb0ecf3 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Fri, 23 Oct 2026 18:48:02 +0200 Subject: [PATCH] chore: test the round 4 wiki copy --- tests/test_site_copy.py | 4 +- tests/test_site_funnel.py | 7 + tests/test_site_r2_wiki.py | 12 +- tests/test_site_r3_wiki.py | 10 +- tests/test_site_r4_wiki.py | 352 +++++++++++++++++++++++++++++++++++++ wiki/testing-guide.md | 2 +- 6 files changed, 376 insertions(+), 11 deletions(-) create mode 100644 tests/test_site_r4_wiki.py diff --git a/tests/test_site_copy.py b/tests/test_site_copy.py index ebf80951..3f7dff44 100644 --- a/tests/test_site_copy.py +++ b/tests/test_site_copy.py @@ -32,8 +32,8 @@ START_PAGES = { "which-pack.md": 400, "wiki/what-are-bios-files.md": 300, "wiki/first-install.md": 400, - "wiki/troubleshooting.md": 300, - "wiki/faq.md": 450, + "wiki/troubleshooting.md": 345, + "wiki/faq.md": 480, "wiki/glossary.md": 200, } # Level 1: the guide part of each setup page, above its Reference heading. diff --git a/tests/test_site_funnel.py b/tests/test_site_funnel.py index d9ff2b25..099c721e 100644 --- a/tests/test_site_funnel.py +++ b/tests/test_site_funnel.py @@ -201,6 +201,11 @@ class DeepLinksCarryALabel(unittest.TestCase): more says what it leads to, with that page's level label before it on its line, or in the heading of its section ("## Reference: ...").""" + # Answers a start page sends its reader to on purpose: the arcade + # version table opens on one plain sentence, and "Reference:" before + # its link read as a broken crumb (round 4, C4 and C9). + ANSWERS = ("/retrobios/wiki/technical-faq/#which-mame-version-do-the-arcade-bios-sets-match",) + def test_start_and_setup_pages(self): import sitestarlight # noqa: PLC0415 @@ -228,6 +233,8 @@ class DeepLinksCarryALabel(unittest.TestCase): deeper = levels[target] if ORDER.index(deeper) - ORDER.index(level) < 2: continue + if any(f"]({answer})" in match.group(0) for answer in self.ANSWERS): + continue label = f"{generate_site.LEVELS[deeper]}:" if label not in line[: match.start()] and not any( heading.startswith(label) for heading in headings.values()): diff --git a/tests/test_site_r2_wiki.py b/tests/test_site_r2_wiki.py index 361114bd..f3c58db0 100644 --- a/tests/test_site_r2_wiki.py +++ b/tests/test_site_r2_wiki.py @@ -360,11 +360,15 @@ class InstallerOptionsAtAGlance(unittest.TestCase): listed = {usage.split()[0].rstrip(",") for usage, _ in sitediagrams.installer_options()} self.assertEqual(declared | {"--help"}, listed) - def test_the_built_page_opens_on_the_table(self): + def test_the_built_page_opens_on_a_link_per_option(self): text = _built("wiki/installer.md") - table = text.index("| Option | What it does | More |") - self.assertLess(table, text.index("## One line")) - self.assertIn("| `--check` |", text) + glance = text.index("## Options at a glance") + self.assertLess(glance, text.index("## One line")) + listed = text[glance:text.index("## One line")] + for usage, _ in sitediagrams.installer_options(): + flag = usage.split()[0].rstrip(",") + with self.subTest(option=flag): + self.assertIn(f"[`{flag}`](#option-{flag.lstrip('-')})", listed) self.assertNotIn("