Stop pages stating false or contradictory things, and fix two phone layout bugs

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Fable 5.2 committed 2026-11-19 10:38:11 -07:00
1 parent 46b27acc9c
commit b1e3f3fb85
12 files changed
+299 -39

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
"""Tests for the held-needs-a-note rule in tools/validate.py.
Run from the repository root:
python3 -m unittest discover tools/tests
"""
import os
import sys
import unittest
sys.dont_write_bytecode = True
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import validate as V # noqa: E402
def check(rec):
errors = []
V.check_held_note("t", rec, errors)
return errors
class HeldNoteTests(unittest.TestCase):
def test_held_without_a_note_fails(self):
self.assertEqual(len(check({"wave": "held"})), 1)
self.assertEqual(len(check({"wave": "held", "wave_note": " "})), 1)
def test_held_with_a_note_passes(self):
self.assertEqual(check({"wave": "held", "wave_note": "No whole track exists."}), [])
def test_other_waves_need_no_note(self):
self.assertEqual(check({"wave": 1}), [])
self.assertEqual(check({}), [])
if __name__ == "__main__":
unittest.main()
+7
View File
@@ -466,6 +466,12 @@ def _whole_km(value):
return isinstance(value, int) and not isinstance(value, bool) and value > 0
def check_held_note(tid, rec, errors):
"""A held record says why in wave_note: the page quotes it, and says nothing when there is none."""
if str(rec.get("wave", "")) == "held" and not str(rec.get("wave_note", "")).strip():
errors.append(f"{tid}: wave is held but wave_note does not say why")
def check_length_facts(tid, rec, errors):
"""system_km, system_note and built_km (docs/schema.md, "What length_km counts").
@@ -754,6 +760,7 @@ def main():
check_short_name(tid, rec, errors)
check_common_name(tid, rec, errors)
check_length_facts(tid, rec, errors)
# check_held_note(tid, rec, errors) # to switch on once the five held records have their notes
if rec.get("id") != tid:
errors.append(f"{tid}: id {rec.get('id')!r} does not match directory name")
if rec.get("country") not in ("US", "CA"):