feat: Mastodon Post Composition and Publishing 1.00
This commit is contained in:
+35
-1
@@ -133,6 +133,13 @@ def test_iter_anniversary_paths_yields_only_path(tmp_path: Path) -> None:
|
||||
# (2016) does not equal target_year (2015), so it does NOT match under
|
||||
# the strict year-equality rule.
|
||||
(date(2025, 3, 1), "2016-02-29", False),
|
||||
# Feb 29 source (2016) in a leap current year (2028), today is Feb 29:
|
||||
# target_year (2018) is not a leap year, but the Feb 29 -> Feb 29
|
||||
# leap-year branch accepts any prior Feb 29 post.
|
||||
(date(2028, 2, 29), "2016-02-29", True),
|
||||
# Feb 29 source (2020) in a leap current year (2028), today is Feb 29:
|
||||
# same branch, also matches.
|
||||
(date(2028, 2, 29), "2020-02-29", True),
|
||||
],
|
||||
)
|
||||
def test_leap_day_matching(
|
||||
@@ -140,7 +147,8 @@ def test_leap_day_matching(
|
||||
) -> None:
|
||||
root = tmp_path / "_posts" / "blog"
|
||||
target_year = today.year - 10
|
||||
rel = f"{target_year}/{source_iso}-leap.md"
|
||||
post_year = int(source_iso.split("-", 1)[0])
|
||||
rel = f"{post_year}/{source_iso}-leap.md"
|
||||
_write_post(
|
||||
root,
|
||||
rel,
|
||||
@@ -155,6 +163,32 @@ def test_leap_day_matching(
|
||||
assert rel not in matched_paths
|
||||
|
||||
|
||||
def test_leap_day_feb29_matches_with_canonical_url(tmp_path: Path) -> None:
|
||||
root = tmp_path / "_posts" / "blog"
|
||||
rel = "2016/2016-02-29-ten-years-before-2026.md"
|
||||
_write_post(
|
||||
root,
|
||||
rel,
|
||||
body=(
|
||||
"---\n"
|
||||
"title: Would Be Ten Years Ago Today In 2026 Mar 1\n"
|
||||
"date: 2016-02-29 08:00:00\n"
|
||||
"---\n"
|
||||
"body\n"
|
||||
),
|
||||
)
|
||||
|
||||
today = date(2028, 2, 29)
|
||||
matches = find_anniversary_matches(root, SITE_URL, today=today)
|
||||
|
||||
assert len(matches) == 1
|
||||
match = matches[0]
|
||||
assert match.path == rel
|
||||
assert match.date == date(2016, 2, 29)
|
||||
assert match.title == "Would Be Ten Years Ago Today In 2026 Mar 1"
|
||||
assert match.url == "https://chaospott.de/2016/02/29/would-be-ten-years-ago-today-in-2026-mar-1/"
|
||||
|
||||
|
||||
def test_match_uses_datetime_frontmatter_date(tmp_path: Path) -> None:
|
||||
root = tmp_path / "_posts" / "blog"
|
||||
_write_post(
|
||||
|
||||
Reference in New Issue
Block a user