Merge main into places-ship-2: the seasons ship touched 39 records and the changelog; both sides kept, this ship's entry first

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Sonnet 5.5 committed 2026-11-20 12:32:31 -07:00
commit 86de4495b0
47 files changed
+772 -16

No files matched your search

+67
View File
@@ -476,6 +476,57 @@ asked_by = "the dataset's own check"
'''
SEASON_PROPOSAL = '''
[[proposal]]
kind = "change"
id = "aaa"
date = "2026-11-30"
summary = "A season from the club's page."
[[proposal.edit]]
field = "hike.season"
new = "Late June to mid-September"
page = "https://example.org/aaa/season"
quote = "Hike it from late June through mid-September."
[[proposal.edit]]
field = "hike.months"
new = [7, 8, 9]
page = "https://example.org/aaa/season"
quote = "Hike it from late June through mid-September."
[[proposal.edit]]
field = "hike.season_basis"
new = "primary"
page = "https://example.org/aaa/season"
quote = "Hike it from late June through mid-September."
[[proposal.edit]]
field = "hike.checked"
old = "2026-11-13"
new = "2026-11-30"
page = "https://example.org/aaa/season"
quote = "Hike it from late June through mid-September."
[[proposal.append]]
table = "hike.source"
page = "https://example.org/aaa/season"
quote = "Hike it from late June through mid-September."
[proposal.append.entry]
url = "https://example.org/aaa/season"
publisher = "Example Club"
facts = ["season", "months"]
[proposal.history]
change = "The record gained a season."
basis = "The club's page says: Hike it from late June through mid-September."
basis_url = "https://example.org/aaa/season"
fields = ["hike.season", "hike.months", "hike.season_basis"]
asked_by = "the dataset's own check"
'''
class CollectTest(Tmp):
def collect(self):
code, out = main(self.root, "--dir", self.d, "collect")
@@ -731,6 +782,22 @@ class ApplyTest(Tmp):
H.check_entries("aaa", rec, errors)
self.assertEqual(errors, [])
def test_a_researched_season_proposal_collects_and_applies(self):
import validate as V
propose(self.d, "season-01", "aaa", SEASON_PROPOSAL)
self.collect_accept_all()
code, out = self.apply()
self.assertEqual(code, 0, out)
rec = self.rec("aaa")
self.assertEqual(rec["hike"]["season"], "Late June to mid-September")
self.assertEqual(rec["hike"]["months"], [7, 8, 9])
self.assertEqual(rec["hike"]["season_basis"], "primary")
self.assertEqual(rec["hike"]["source"][-1]["facts"], ["season", "months"])
errors = []
V.season.check_season("aaa", rec["hike"], errors)
H.check_entries("aaa", rec, errors)
self.assertEqual(errors, [])
def test_only_accepted_proposals_apply(self):
propose(self.d, "trails-01", "aaa", PERMIT_CHANGE)
main(self.root, "--dir", self.d, "collect")
+14
View File
@@ -80,6 +80,20 @@ class SeasonBasisTest(unittest.TestCase):
same = [src("Park Service"), src("Park Service", url="https://example.org/b")]
self.assertEqual(check(season_basis="source", source=same), [])
def test_method_is_allowed_with_sources_only_besides_estimate(self):
two = [src("Park Service"), src("Blog", url="https://example.org/b")]
ok = check(season_basis="sources", source=two,
season_method="The pages differ; set from both and the climate estimate.")
self.assertEqual(ok, [])
self.assertEqual(check(season_basis="sources", source=two), [])
for basis in ("primary", "source"):
errors = check(season_basis=basis, season_method="Some sentence.")
self.assertTrue(any("season_method" in e for e in errors), (basis, errors))
long = check(season_basis="sources", source=two, season_method="x" * 401)
self.assertTrue(any("400" in e for e in long), long)
blank = check(season_basis="sources", source=two, season_method=" ")
self.assertTrue(any("season_method" in e for e in blank), blank)
def test_primary_needs_a_naming_source(self):
errors = check(source=[src("Park Service", facts=("days",))])
self.assertTrue(errors)
+1 -1
View File
@@ -95,7 +95,7 @@ class TableTest(unittest.TestCase):
r = refresh.load_toml(os.path.join(V.ROOT, tid, "trail.toml"))
if (r.get("hike") or {}).get("season"):
expected += 1
self.assertEqual(expected, 109)
self.assertGreaterEqual(expected, 109)
self.assertEqual(len(rows), expected)
for row in rows:
self.assertIn(row["suggested"], season.BASES)