Say season once where a source names season and months

This commit is contained in:
swaits committed 2026-11-20 13:33:21 -07:00
1 parent b498cf25eb
commit 3305c23ee5
2 files changed
+7 -1

No files matched your search

+1 -1
View File
@@ -1567,7 +1567,7 @@ def hike_sources_block(rec):
for src in hike.sources(rec):
url = src.get("url", "")
who = src.get("publisher") or (host(url) if url else "Source")
facts_ = [words.HIKE_FACTS.get(f, f) for f in src.get("facts", [])]
facts_ = list(dict.fromkeys(words.HIKE_FACTS.get(f, f) for f in src.get("facts", []))) # season and months read alike
what = ("For " + words.join_names(facts_)) if facts_ else ""
link = ext_link(url, who) if url else esc(who)
detail = " · ".join(x for x in (host(url) if url else "", what) if x)
+6
View File
@@ -153,6 +153,12 @@ class TrailPageTest(unittest.TestCase):
block = html.unescape(trail.hike_sources_block(rec))
self.assertIn("Snow and mud last into March. Confidence: high. No page states a season.", block)
def test_a_source_naming_season_and_months_says_season_once(self):
rec = sample_record("X Trail")
rec["hike"] = dict(FULL_HIKE, season_basis="primary")
block = html.unescape(trail.hike_sources_block(rec))
self.assertNotIn("season and season", block)
def test_a_stated_season_row_has_no_note(self):
rec = sample_record("X Trail")
rec["hike"] = dict(FULL_HIKE, season_basis="primary")