def test_last_newsletters_extracts_last_month_of_the_year(repo: Repo) -> None:
    """
    Given: A Files object with a File object newsletter/2020_11.md and
        newsletter/2020_12.md.
    When: last_newsletters is called
    Then: A LastNewsletter object is returned that returns a datetime object with
        2021-01-01 as last date for the month periodicity.
    """
    newsletter_dir = create_files(["2020_11.md", "2020_12.md"], repo)

    result = last_newsletter_changes(newsletter_dir)

    assert result.monthly == datetime(2021, 1, 1, tzinfo=tz.tzlocal())
def test_last_newsletters_extracts_last_week(repo: Repo) -> None:
    """
    Given: A Files object with two File objects newsletter/2020_w01.md and
        newsletter/2020_w02.md.
    When: last_newsletters is called
    Then: A LastNewsletter object is returned that returns a datetime object with
        the monday of the third week of the year for the week periodicity.
    """
    newsletter_dir = create_files(["2020_w01.md", "2020_w02.md"], repo)

    result = last_newsletter_changes(newsletter_dir)

    assert result.weekly == datetime(2020, 1, 13, tzinfo=tz.tzlocal())
def test_last_newsletters_extracts_last_day(repo: Repo) -> None:
    """
    Given: A Files object with two File objects newsletter/2020_01_01.md and
        newsletter/2020_02_02.md.
    When: last_newsletters is called
    Then: A LastNewsletter object is returned that returns a datetime object with
        2020-02-03 as last day for the daily periodicity.
    """
    newsletter_dir = create_files(["2020_01_01.md", "2020_01_02.md"], repo)

    result = last_newsletter_changes(newsletter_dir)

    assert result.daily == datetime(2020, 1, 3, tzinfo=tz.tzlocal())