repositories

NixDaemon

NixOS pentest workstation as one flake — IceBreaker's successor

clonegit clone https://git.daemon-sec.xyz/NixDaemon.git
test_liturgy.pyPython82 lines3.0 KiBraw download
import datetime as dt

import liturgy


# Known Western (Gregorian) Easter dates.
KNOWN_EASTER = {
    2024: dt.date(2024, 3, 31),
    2025: dt.date(2025, 4, 20),
    2026: dt.date(2026, 4, 5),
    2027: dt.date(2027, 3, 28),
    2028: dt.date(2028, 4, 16),
    2029: dt.date(2029, 4, 1),
    2030: dt.date(2030, 4, 21),
}


def test_easter_known_dates():
    for year, expected in KNOWN_EASTER.items():
        assert liturgy.easter(year) == expected, year


def test_advent_2025_starts_nov_30():
    # Dec 25 2025 is a Thursday; last Sunday strictly before is Dec 21;
    # Advent 1 is three Sundays earlier.
    assert liturgy.season(dt.date(2025, 11, 30)).id == "advent"
    assert liturgy.season(dt.date(2025, 11, 29)).id == "ordinary"


def test_advent_2026_starts_nov_29():
    assert liturgy.season(dt.date(2026, 11, 29)).id == "advent"
    assert liturgy.season(dt.date(2026, 11, 28)).id == "ordinary"


def test_christmastide_spans_year_boundary():
    assert liturgy.season(dt.date(2025, 12, 25)).id == "christmastide"
    assert liturgy.season(dt.date(2026, 1, 5)).id == "christmastide"
    assert liturgy.season(dt.date(2026, 1, 6)).id == "ordinary"


def test_lent_and_holy_week_2026():
    # Easter 2026-04-05 -> Ash Wednesday Feb 18, Palm Sunday Mar 29.
    assert liturgy.season(dt.date(2026, 2, 17)).id == "ordinary"
    assert liturgy.season(dt.date(2026, 2, 18)).id == "lent"
    assert liturgy.season(dt.date(2026, 3, 28)).id == "lent"
    assert liturgy.season(dt.date(2026, 3, 29)).id == "holy_week"
    assert liturgy.season(dt.date(2026, 4, 4)).id == "holy_week"
    assert liturgy.season(dt.date(2026, 4, 5)).id == "eastertide"


def test_eastertide_ends_at_pentecost_2026():
    # Pentecost = Easter + 49 = May 24 2026.
    assert liturgy.season(dt.date(2026, 5, 24)).id == "eastertide"
    assert liturgy.season(dt.date(2026, 5, 25)).id == "ordinary"


def test_feasts_2026():
    assert liturgy.feast(dt.date(2026, 12, 25)).id == "christmas"
    assert liturgy.feast(dt.date(2026, 1, 6)).id == "epiphany"
    assert liturgy.feast(dt.date(2026, 2, 18)).id == "ash_wednesday"
    assert liturgy.feast(dt.date(2026, 3, 29)).id == "palm_sunday"
    assert liturgy.feast(dt.date(2026, 4, 3)).id == "good_friday"
    assert liturgy.feast(dt.date(2026, 4, 5)).id == "easter_day"
    assert liturgy.feast(dt.date(2026, 5, 14)).id == "ascension"
    assert liturgy.feast(dt.date(2026, 5, 24)).id == "pentecost"
    assert liturgy.feast(dt.date(2026, 11, 1)).id == "all_saints"
    assert liturgy.feast(dt.date(2026, 7, 14)) is None


def test_every_feast_is_complete():
    for fid, f in liturgy.FEAST_DEFS.items():
        assert f.id == fid
        assert f.name and f.verse and f.emblem
        assert len(f.roles) == 2


def test_every_season_has_role_pair():
    for d in (dt.date(2026, 1, 2), dt.date(2026, 2, 20), dt.date(2026, 4, 1),
              dt.date(2026, 4, 20), dt.date(2026, 8, 12), dt.date(2026, 12, 1),
              dt.date(2026, 12, 26)):
        s = liturgy.season(d)
        assert len(s.roles) == 2 and s.name