Show each trail's own emblem, keep a history on every record, and list what was left out
- Emblems for 81 trails, up from 41. Each is the trail's own crest, badge or roundel alone, cropped out of a larger logo where need be and made transparent where that could be done cleanly. Records without one say where an emblem was looked for. The validator checks the logo state. - Every record has a `[[history]]` list: what changed or was asked for, on what basis, who asked and whether it was applied or declined. `tools/check_history.py` fails a changed fact with no history entry and prints earlier entries about a changed field. It runs in CI before the site deploys. Each trail page shows the history. - A new page, "Considered and left out", built from `left-out.toml`: 35 trails and routes with the reason, the deciding fact and its source. - The Hoosier Heritage Trail has its ends, its free map set and its emblem from its association (issue 2). Any trail may list its holder's own guide or map set. - A stated permission is quoted in the download credit box. - `tools/gpx_track.py` turns a GPX file from a holder or a hiker into a record's track files. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
d34a9617cd
commit
24bfbb2fa8
374 files changed
+7796
-703
No files matched your search
@@ -0,0 +1,106 @@
|
||||
"""Tests for the Considered and left out page (web/olt/leftout.py).
|
||||
|
||||
Run from the repository root:
|
||||
python3 -m unittest discover -s web/tests
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
WEB = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
ROOT = os.path.dirname(WEB)
|
||||
sys.path.insert(0, WEB)
|
||||
|
||||
from olt import leftout, seo, site # noqa: E402
|
||||
|
||||
ENTRIES = [
|
||||
{
|
||||
"id": "waiting-trail",
|
||||
"name": "Waiting Trail",
|
||||
"country": "US",
|
||||
"regions": ["KY"],
|
||||
"length_mi": 120,
|
||||
"length_km": 193,
|
||||
"length_note": "120 miles planned",
|
||||
"reason": "waiting",
|
||||
"note": "Only part of it is built.",
|
||||
"source_url": "https://example.org/waiting",
|
||||
"decided": "2026-11-16",
|
||||
"was_listed": False,
|
||||
"waiting_for": "Enough of it is built to walk through.",
|
||||
},
|
||||
{
|
||||
"id": "example-trail",
|
||||
"name": "Example & Trail",
|
||||
"country": "US",
|
||||
"regions": ["PA", "MD"],
|
||||
"length_mi": 42.0,
|
||||
"length_km": 68,
|
||||
"reason": "below-floor",
|
||||
"note": "The holder gives it as 42 miles.",
|
||||
"source_url": "https://example.org/example?a=1&b=2",
|
||||
"decided": "2026-11-14",
|
||||
"was_listed": True,
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
class PageTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.site = site.Site(name="Long Hikes", tagline="Tagline",
|
||||
base_url="https://example.org",
|
||||
repo_url="https://github.com/swaits/longhikes")
|
||||
self.title, self.description, self.body = leftout.left_out_page(
|
||||
ENTRIES, self.site, ROOT)
|
||||
self.text = str(self.body)
|
||||
|
||||
def test_title(self):
|
||||
self.assertEqual(self.title, "Considered and left out")
|
||||
|
||||
def test_opening_is_generated_from_the_entries(self):
|
||||
self.assertIn("lists 2 trails and routes", self.text)
|
||||
self.assertIn("1 of them was listed here once", self.text)
|
||||
self.assertIn("open an issue", self.text)
|
||||
|
||||
def test_grouped_by_reason_in_order(self):
|
||||
self.assertLess(self.text.index("Below the 50 mile floor"),
|
||||
self.text.index("Waiting"))
|
||||
|
||||
def test_entry_facts_and_escaping(self):
|
||||
self.assertIn("Example & Trail", self.text)
|
||||
self.assertIn("Pennsylvania", self.text)
|
||||
self.assertIn("Maryland", self.text)
|
||||
self.assertIn("42 mi", self.text)
|
||||
self.assertIn("68 km", self.text)
|
||||
self.assertIn("The holder gives it as 42 miles.", self.text)
|
||||
self.assertIn('datetime="2026-11-14"', self.text)
|
||||
self.assertIn('href="https://example.org/example?a=1&b=2"', self.text)
|
||||
|
||||
def test_once_listed_mark(self):
|
||||
self.assertIn("Once listed here", self.text)
|
||||
self.assertEqual(self.text.count("Once listed here"), 1)
|
||||
|
||||
def test_waiting_shows_what_would_change_it(self):
|
||||
self.assertIn("Enough of it is built to walk through.", self.text)
|
||||
self.assertIn("120 miles planned", self.text)
|
||||
|
||||
def test_no_length_shows_nothing_made_up(self):
|
||||
entries = [dict(ENTRIES[1])]
|
||||
del entries[0]["length_mi"], entries[0]["length_km"]
|
||||
_, _, body = leftout.left_out_page(entries, self.site, ROOT)
|
||||
self.assertNotIn("len__mi", str(body))
|
||||
|
||||
def test_sitemap_includes_the_page(self):
|
||||
self.assertIn("/left-out/", seo.all_paths([], []))
|
||||
|
||||
def test_the_real_file_loads_sorted(self):
|
||||
entries = leftout.load_entries(ROOT)
|
||||
self.assertGreaterEqual(len(entries), 30)
|
||||
names = [e["name"].lower() for e in entries]
|
||||
self.assertEqual(names, sorted(names))
|
||||
reasons = {e["reason"] for e in entries}
|
||||
self.assertTrue(reasons <= set(leftout.REASON_ORDER))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user