A deeper, region-by-region search of the web added 14 official trails and 4 routes. The Hoosier Heritage Trail was added at its association's request (issue 2) with the association's own track, shared by written permission. - New licence value `stated-permission`, with the quoted words, who gave them, when and where as fields of the record, shown on the trail page and carried in the GPX description. - Tracks from OpenStreetMap or the Forest Service's open trail data for eleven of the new trails and seven existing ones. `tools/osm_track.py` can join several relations and leave ways out by name. - The C&O Canal Towpath is removed: the rule leaves out canal towpaths. - The Grand Enchantment Trail is recorded as a route by its author, with no track. - Corrections to the Finger Lakes, Ozark Highlands, Eastern Continental and Knobstone records, checked against the pages they cite. - Site: the list pages' own units switch is gone in favour of the header one; the map switch and a swapped length range stay in step with the page. - CHANGELOG.md brought up to date from the site's opening to today. 204 trails: 147 official trails and 57 routes; 126 have a track. 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), 204)
|
|
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), 147)
|
|
self.assertEqual(sum(r["derived"]["has_line"] for r in self.recs), 126)
|
|
|
|
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()
|