Say season once where a source names season and months
This commit is contained in:
1 parent
b498cf25eb
commit
3305c23ee5
2 files changed
+7
-1
No files matched your search
+1
-1
@@ -1567,7 +1567,7 @@ def hike_sources_block(rec):
|
|||||||
for src in hike.sources(rec):
|
for src in hike.sources(rec):
|
||||||
url = src.get("url", "")
|
url = src.get("url", "")
|
||||||
who = src.get("publisher") or (host(url) if url else "Source")
|
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 ""
|
what = ("For " + words.join_names(facts_)) if facts_ else ""
|
||||||
link = ext_link(url, who) if url else esc(who)
|
link = ext_link(url, who) if url else esc(who)
|
||||||
detail = " · ".join(x for x in (host(url) if url else "", what) if x)
|
detail = " · ".join(x for x in (host(url) if url else "", what) if x)
|
||||||
|
|||||||
@@ -153,6 +153,12 @@ class TrailPageTest(unittest.TestCase):
|
|||||||
block = html.unescape(trail.hike_sources_block(rec))
|
block = html.unescape(trail.hike_sources_block(rec))
|
||||||
self.assertIn("Snow and mud last into March. Confidence: high. No page states a season.", block)
|
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):
|
def test_a_stated_season_row_has_no_note(self):
|
||||||
rec = sample_record("X Trail")
|
rec = sample_record("X Trail")
|
||||||
rec["hike"] = dict(FULL_HIKE, season_basis="primary")
|
rec["hike"] = dict(FULL_HIKE, season_basis="primary")
|
||||||
|
|||||||
Reference in new issue
Block a user