Merge Paris and Lille photo highlights

This commit is contained in:
2026-09-20 01:16:09 +03:30
parent a0e093b91a
commit afb4ed2676
25 changed files with 73 additions and 24 deletions
+20
View File
@@ -65,6 +65,8 @@ COLLECTIONS = [
"Belfast_000512350018.jpg",
]),
]
PARIS = "85a558a3fcf582e6f0637d6927bb5a074de422f30a389ab9589630b9c163fc0e"
PARIS_LILLE = "e013523e4dda324d603c89f93ef3e83abbcd82cb11a16f85e53b670e8613d34f"
class PhotoHighlightTests(unittest.TestCase):
@@ -106,6 +108,24 @@ class PhotoHighlightTests(unittest.TestCase):
self.assertEqual([filename for _, filename in records], filenames)
self.assertEqual(len({date for date, _ in records}), len(filenames))
def test_paris_and_lille_is_one_contiguous_highlight(self):
records = []
anchors = []
for job, count in ((PARIS_LILLE, 13), (PARIS, 10)):
for index in range(count):
path = ART / f"2026-09-19-photo-{job}-{index:02}.md"
content = path.read_text()
date = re.search(r'^date: "([^"]+)"', content, re.MULTILINE)
records.append((datetime.fromisoformat(date.group(1)), job, index))
anchors.extend(re.findall(r'^anchor: "([^"]+)"', content, re.MULTILINE))
records.sort(reverse=True)
self.assertEqual([(job, index) for _, job, index in records],
[(PARIS_LILLE, index) for index in range(13)] +
[(PARIS, index) for index in range(10)])
self.assertEqual(anchors, ["Paris & Lille"])
former_paris = (ART / f"2026-09-19-photo-{PARIS}-00.md").read_text()
self.assertIn(f'<div id="photo-{PARIS}"></div>', former_paris)
if __name__ == "__main__":
unittest.main()