Place the Mogollon Rim Trail in the White Mountains of Arizona, and refuse a place that lies in none of a trail's states or provinces
A new registry range, white-mountains-arizona, shown as White Mountains, in Arizona. The validator now fails a record whose place's where shares no state or province with the record's regions, and place_trails.py no longer places a trail in a place outside its regions. The rule also caught the Hot Springs Trail (Nevada missing from its regions) and the North Boundary Trail (British Columbia missing), which now list those regions, and the Sentier international des Appalaches, whose track carries the Maine IAT into Katahdin Woods and Waters: that placement is removed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7e4d1de494
commit
3b745f706c
12 files changed
+111
-26
No files matched your search
@@ -111,6 +111,17 @@ class ProposalTest(unittest.TestCase):
|
||||
self.park_only = LineString([(-109.9, 43.2), (-109.9, 43.29)])
|
||||
self.outside = LineString([(-107.0, 43.2), (-107.0, 43.29)])
|
||||
|
||||
def test_a_place_outside_the_trails_regions_does_not_place_it(self):
|
||||
p = P.propose([rec("a", ["NH"], self.inside)], [self.park, self.range])
|
||||
self.assertEqual(p.per_trail["a"], [])
|
||||
p = P.propose([rec("a", ["NH", "WY"], self.inside)], [self.park, self.range])
|
||||
self.assertEqual({k for k, _km in p.per_trail["a"]}, {("park", "alpha-park"), ("range", "beta-range")})
|
||||
|
||||
def test_the_registrys_reviewed_where_wins(self):
|
||||
p = P.propose([rec("a", ["NH"], self.inside)], [self.park],
|
||||
{("park", "alpha-park"): ["NH"]})
|
||||
self.assertEqual([k for k, _km in p.per_trail["a"]], [("park", "alpha-park")])
|
||||
|
||||
def test_propose_lists_per_trail_places_and_per_place_trails(self):
|
||||
records = [rec("a", ["WY"], self.inside), rec("b", ["WY"], self.park_only),
|
||||
rec("c", ["WY"], self.inside)]
|
||||
@@ -189,6 +200,13 @@ class ProposalTest(unittest.TestCase):
|
||||
out = P.assign_slugs(out)
|
||||
self.assertEqual(out[0].slug, "palisades") # no numeric suffix, no state code
|
||||
|
||||
def test_two_ranges_of_one_display_name_with_different_slugs_stay_two_places(self):
|
||||
a = outline("range", "12331", "White Mountains", self.park.geometry, slug="white-mountains")
|
||||
b = outline("range", "16575", "White Mountains", self.range.geometry,
|
||||
slug="white-mountains-arizona")
|
||||
self.assertEqual([o.slug for o in P.merge_same_name([a, b])],
|
||||
["white-mountains", "white-mountains-arizona"])
|
||||
|
||||
def test_the_same_name_from_two_sources_or_kinds_is_not_merged(self):
|
||||
a = outline("park", "1", "Glacier", self.park.geometry, hint=["MT"])
|
||||
b = outline("park", "2", "Glacier", self.range.geometry, hint=["BC"])
|
||||
|
||||
@@ -183,3 +183,19 @@ class WholeRepoTest(unittest.TestCase):
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
|
||||
class PlaceLiesInTheTrailsRegionsTest(unittest.TestCase):
|
||||
def stated(self, **kw):
|
||||
return record(regions=kw.pop("regions"), places_checked="2026-11-20",
|
||||
place=[{"kind": "range", "slug": "wind-river-range", "basis": "stated",
|
||||
"source": "https://example.org/x"}])
|
||||
|
||||
def test_a_place_in_one_of_the_trails_states_passes(self):
|
||||
errs = record_errors(self.stated(regions=["ID", "WY"]))
|
||||
self.assertEqual([e for e in errs if "lies in" in e], [])
|
||||
|
||||
def test_a_place_in_none_of_the_trails_states_fails(self):
|
||||
errs = record_errors(self.stated(regions=["AZ", "NM"]))
|
||||
self.assertTrue(any("range/wind-river-range lies in WY, none of the record's regions (AZ, NM)" in e
|
||||
for e in errs), errs)
|
||||
Reference in new issue
Block a user