Files
longhikes/web/tests/test_records.py
T
swaitsandClaude Fable 5.2 f88d37f196
Mirror to forge / mirror (push) Canceled after 0s
Validate / validate (push) Canceled after 0s
Validate / history (push) Canceled after 0s
Validate / site (push) Canceled after 0s
Validate / deploy (push) Canceled after 0s
Add the Escalante Overland Route, note Paria Canyon and Grand Gulch as left out, and let biographies use sourced pronouns
The Escalante Overland Route is Steve Allen's 80-mile rim route from his
1997 guidebook, recorded without a track. Paria Canyon joins the left-out
list as below the floor, and the Grand Gulch note gains the through
length a guide site gives. 17 author biographies now use the pronoun
their cited sources use in place of repeating the surname.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-18 04:40:21 -07:00

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), 199)
self.assertEqual(sum(r["derived"]["kind"] == "route" for r in self.recs), 59)
self.assertEqual(sum(r["derived"]["kind"] == "designated" for r in self.recs), 140)
self.assertEqual(sum(r["derived"]["has_line"] for r in self.recs), 121)
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()