Lengths and what belongs: - A trail's length is now the end-to-end length of its canonical path: one branch at a split, no side trails, no system totals. A holder's larger figure and the built length of an unfinished trail are separate fields (`system_km`, `system_note`, `built_km`), shown under the length. - Corrected: Florida Trail 1,500 to 1,130 mi, American Discovery Trail 6,800 to 5,008 mi, Ozark Trail to 230 mi, General Crook Trail to 138 mi, Sheltowee Trace to 343 mi, Allegheny Trail to 316 mi, Great Eastern Trail to 1,800 mi. - The Florida Trail's and the Ice Age Trail's main tracks are re-cut as one walk; the other branches are alternates. - A trail must be walkable from end to end today. Nine trails that are not, are a network, or fall under the floor move to the "Considered and left out" list. The Bayou State Trail is added. 196 trails. Pages: - The trail page puts the map and At a glance directly under the title; the home page drops its oversized hero and shows the trails and the map at once. Place and list pages put the list beside the map. - Every map starts by itself once the page is ready, over a drawing of the tracks that is in the page from the first paint. - Lists is in the header. The home page shows ten lists chosen in `collections.toml`. Tables have equal columns and stack on a phone. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
49 lines
1.8 KiB
Python
49 lines
1.8 KiB
Python
import os
|
|
import sys
|
|
import unittest
|
|
|
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
|
|
from olt import records # noqa: E402
|
|
|
|
|
|
class RecordsTest(unittest.TestCase):
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
cls.recs = records.load_records()
|
|
|
|
def test_counts(self):
|
|
self.assertEqual(len(self.recs), 196)
|
|
self.assertEqual(sum(r["derived"]["kind"] == "route" for r in self.recs), 57)
|
|
self.assertEqual(sum(r["derived"]["kind"] == "designated" for r in self.recs), 139)
|
|
self.assertEqual(sum(r["derived"]["has_line"] for r in self.recs), 118)
|
|
|
|
def test_sorted_by_id(self):
|
|
ids = [r["id"] for r in self.recs]
|
|
self.assertEqual(ids, sorted(ids))
|
|
|
|
def test_derived_fields(self):
|
|
by_id = {r["id"]: r for r in self.recs}
|
|
ct = by_id["colorado-trail"]
|
|
self.assertEqual(ct["derived"]["status"], "included")
|
|
self.assertEqual(ct["derived"]["length_mi"], 486)
|
|
self.assertEqual(sorted(ct["derived"]["files"]["extracts"]), ["osm", "usfs"])
|
|
self.assertEqual(ct["derived"]["files"]["line"], "colorado-trail/line.geojson")
|
|
self.assertEqual(ct["name"], "Colorado Trail") # TOML fields unchanged
|
|
|
|
def test_status_matches_csv(self):
|
|
import csv
|
|
path = os.path.join(records.ROOT, "trails.csv")
|
|
with open(path, encoding="utf-8", newline="") as f:
|
|
status = {row["id"]: row["status"] for row in csv.DictReader(f)}
|
|
for r in self.recs:
|
|
self.assertEqual(r["derived"]["status"], status[r["id"]])
|
|
|
|
def test_line_file_exists_when_has_line(self):
|
|
for r in self.recs:
|
|
self.assertEqual(r["derived"]["has_line"], "line" in r["derived"]["files"])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|