Fix the season wording and checks after review

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Sonnet 5.5 committed 2026-11-20 10:22:29 -07:00
1 parent 157f268974
commit 1c60e0c14c
7 files changed
+19 -5

No files matched your search

+7
View File
@@ -55,6 +55,13 @@ def check_season(tid, hike, errors):
if not naming_season:
errors.append(
f"{tid}: hike.season_basis \"{basis}\" needs a [[hike.source]] naming season")
elif basis == "source":
publishers = {str(s.get("publisher", "")).strip().casefold()
for s in naming_season}
if len(publishers) != 1:
errors.append(
f"{tid}: hike.season_basis \"source\" needs exactly one publisher "
"naming season (two or more is \"sources\")")
elif basis == "sources":
publishers = {str(s.get("publisher", "")).strip().casefold()
for s in naming_season if str(s.get("publisher", "")).strip()}
+7
View File
@@ -73,6 +73,13 @@ class SeasonBasisTest(unittest.TestCase):
errors = check(season_basis="source", source=[src("Guide A", facts=("days",))])
self.assertTrue(errors)
def test_source_basis_needs_exactly_one_publisher(self):
two = [src("Park Service"), src("Blog", url="https://example.org/b")]
errors = check(season_basis="source", source=two)
self.assertTrue(any("exactly one publisher" in e for e in errors), errors)
same = [src("Park Service"), src("Park Service", url="https://example.org/b")]
self.assertEqual(check(season_basis="source", source=same), [])
def test_primary_needs_a_naming_source(self):
errors = check(source=[src("Park Service", facts=("days",))])
self.assertTrue(errors)