Register season_basis and season_method; schema allows estimated seasons

This commit is contained in:
swaits committed 2026-11-20 09:18:33 -07:00
1 parent b0ddaeac48
commit 9528c717f7
3 files changed
+41 -6

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
"""Tests that season_basis and season_method are known fields and documented.
Run from the repository root:
python3 -m unittest discover tools/tests
"""
import os
import sys
import unittest
sys.dont_write_bytecode = True
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import trail_history as H # noqa: E402
import validate as V # noqa: E402
class SeasonFieldsTest(unittest.TestCase):
def test_the_new_fields_are_known_to_the_history_tool(self):
for f in ("hike.season_basis", "hike.season_method"):
self.assertIn(f, H.SCHEMA_FIELDS)
self.assertTrue(H.is_fact(f))
def test_the_facts_text_names_them(self):
self.assertIn("season_basis", H.FACTS_TEXT)
def test_the_schema_documents_them_and_the_estimate_exception(self):
text = open(os.path.join(V.ROOT, "docs", "schema.md"), encoding="utf-8").read()
for needle in ("`season_basis`", "`season_method`", "except season, which may be estimated"):
self.assertIn(needle, text)
if __name__ == "__main__":
unittest.main()
+2 -2
View File
@@ -29,7 +29,7 @@ _TABLES = {
"shield": ("status", "logo_source", "contact", "note", "logo_file", "logo_owner"),
"verification": ("verified", "date", "measured_km", "difference_percent", "parts", "note"),
"hike": ("summary", "official_url", "start", "end", "start_lonlat", "end_lonlat", "shape",
"days", "season", "months", "high_point", "high_point_m", "terrain", "travel",
"days", "season", "months", "season_basis", "season_method", "high_point", "high_point_m", "terrain", "travel",
"permit", "unfinished", "caution", "checked"),
"hike.source": ("url", "publisher", "facts"),
"route": ("creator", "year", "line_policy", "creator_words", "creator_words_url",
@@ -66,7 +66,7 @@ FACTS_TEXT = (
"designation, inclusion; source.* (status, publisher, publisher_url, url, licence, licence_text, "
"permission_*, attribution, osm_only, line_source, line_file, line_absent_reason, "
"decision, decision_text, redistributable); osm.relation; shield.* except note; "
"hike.* except summary, checked and source (start, end, official_url, days, season, terrain, "
"hike.* except summary, checked and source (start, end, official_url, days, season, months, season_basis, season_method, terrain, "
"travel, high_point, permit, unfinished, caution and the rest); route.* except note; "
"guide.* except price. A replaced track file counts as a change to source.line_file."
)