Rewrite the About page's opening for hikers, name the maintainer swaits, and stop typing counts by hand
The About page now opens with what the site is for: finding long trails, including ones the reader has not heard of. The maintainer is shown as swaits, linked to swaits.com. SOURCES.md no longer carries hand-typed trail counts, and tests derive the trail and route totals from the records. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
ba3e7dfd33
commit
d30c56a163
13 files changed
+42
-29
No files matched your search
@@ -59,7 +59,7 @@ class ExtraPagesTest(unittest.TestCase):
|
||||
|
||||
def test_all_routes_on_routes_page(self):
|
||||
routes = [r for r in self.records if r["derived"]["kind"] == "route"]
|
||||
self.assertEqual(len(routes), 78)
|
||||
self.assertGreater(len(routes), 0)
|
||||
page = read_out("routes/index.html")
|
||||
import html as _html
|
||||
text = _html.unescape(re.sub(r"<[^>]+>", "", page)) # a credit naming two authors links each name
|
||||
|
||||
@@ -380,7 +380,7 @@ class BuiltVocabularyTest(unittest.TestCase):
|
||||
def test_an_estimated_season_reads_about_on_its_page_and_a_stated_one_does_not(self):
|
||||
est = [r for r in records.load_records(ROOT) if facets.season_estimated(r)]
|
||||
stated = [r for r in records.load_records(ROOT) if not facets.season_estimated(r)]
|
||||
self.assertEqual(len(est) + len(stated), 224)
|
||||
self.assertEqual(len(est) + len(stated), len(records.load_records(ROOT)))
|
||||
for rec in est[:10]:
|
||||
doc = self.read(f"trails/{rec['id']}/index.html")
|
||||
self.assertIn(facets.season_text(rec), html.unescape(doc), rec["id"])
|
||||
|
||||
@@ -114,7 +114,7 @@ class HistorySectionTest(unittest.TestCase):
|
||||
|
||||
def test_real_records_all_show_their_history(self):
|
||||
recs = records.load_records()
|
||||
self.assertEqual(len(recs), 224)
|
||||
self.assertGreater(len(recs), 0)
|
||||
for rec in recs:
|
||||
part = trail.history_section(rec)
|
||||
self.assertIn("History of this record", part, rec["id"])
|
||||
|
||||
@@ -5,7 +5,7 @@ import unittest
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from olt import md # noqa: E402
|
||||
from olt import md, records # noqa: E402
|
||||
|
||||
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
|
||||
DOCS = ["README.md", "SOURCES.md", "NOTICE.md",
|
||||
@@ -394,7 +394,9 @@ class RealDocumentsTest(unittest.TestCase):
|
||||
counter = TableCounter()
|
||||
counter.feed(md.render(read_doc("README.md")))
|
||||
counter.close()
|
||||
self.assertEqual(counter.counts, [146, 78])
|
||||
recs = records.load_records()
|
||||
routes = sum(r["derived"]["kind"] == "route" for r in recs)
|
||||
self.assertEqual(counter.counts, [len(recs) - routes, routes])
|
||||
|
||||
def test_readme_num_class_present(self):
|
||||
self.assertIn('class="num"', md.render(read_doc("README.md")))
|
||||
|
||||
@@ -92,7 +92,7 @@ class BuiltSiteTest(unittest.TestCase):
|
||||
def test_one_detail_page_per_record(self):
|
||||
found = [d for d in os.listdir(os.path.join(OUT, "trails"))
|
||||
if os.path.isfile(os.path.join(OUT, "trails", d, "index.html"))]
|
||||
self.assertEqual(len(self.records), 224)
|
||||
self.assertEqual(len(self.records), len(records.load_records()))
|
||||
self.assertEqual(sorted(found), sorted(r["id"] for r in self.records))
|
||||
self.assertTrue(os.path.isfile(os.path.join(OUT, "index.html")))
|
||||
|
||||
|
||||
@@ -13,10 +13,13 @@ class RecordsTest(unittest.TestCase):
|
||||
cls.recs = records.load_records()
|
||||
|
||||
def test_counts(self):
|
||||
self.assertEqual(len(self.recs), 224)
|
||||
self.assertEqual(sum(r["derived"]["kind"] == "route" for r in self.recs), 78)
|
||||
self.assertEqual(sum(r["derived"]["kind"] == "designated" for r in self.recs), 146)
|
||||
self.assertEqual(sum(r["derived"]["has_line"] for r in self.recs), 124)
|
||||
dirs = [d for d in os.listdir(records.ROOT) if os.path.isfile(os.path.join(records.ROOT, d, "trail.toml"))]
|
||||
self.assertEqual(len(self.recs), len(dirs))
|
||||
routes = sum(r["derived"]["kind"] == "route" for r in self.recs)
|
||||
designated = sum(r["derived"]["kind"] == "designated" for r in self.recs)
|
||||
self.assertEqual(routes + designated, len(self.recs))
|
||||
self.assertGreater(routes, 0)
|
||||
self.assertGreater(sum(r["derived"]["has_line"] for r in self.recs), 0)
|
||||
|
||||
def test_sorted_by_id(self):
|
||||
ids = [r["id"] for r in self.recs]
|
||||
|
||||
@@ -52,8 +52,8 @@ def sparse_record():
|
||||
|
||||
class MaintainerSettings(unittest.TestCase):
|
||||
def test_site_toml_names_the_maintainer_and_nothing_personal(self):
|
||||
self.assertEqual(SITE.maintainer_name, "Stephen Waits")
|
||||
self.assertEqual(SITE.maintainer_url, "https://github.com/swaits")
|
||||
self.assertEqual(SITE.maintainer_name, "swaits")
|
||||
self.assertEqual(SITE.maintainer_url, "https://swaits.com")
|
||||
with open(site.SITE_TOML, encoding="utf-8") as f:
|
||||
text = f.read()
|
||||
self.assertNotIn("@", re.sub(r"#.*", "", text), "no email address in the settings")
|
||||
|
||||
Reference in new issue
Block a user