def test_get_month_most_posts_more_in_2018(dates):
    # make Jan 2018 > Jan 2017
    for _ in range(25):
        dates.append('Sun, 07 Jan 2018 12:00:00 +0100')

    converted_dates = [convert_to_datetime(d) for d in dates]
    assert get_month_most_posts(converted_dates) == '2018-01'
def test_convert_to_datetime(date_str, expected):
    dt = convert_to_datetime(date_str)
    # support tz aware datetimes
    assert dt.replace(tzinfo=None) == expected.replace(tzinfo=None)
def test_get_month_most_posts(dates):
    converted_dates = [convert_to_datetime(d) for d in dates]
    assert get_month_most_posts(converted_dates) == '2017-01'
Ejemplo n.º 4
0
def test_convert_to_datetime(date_str, dt):
    assert convert_to_datetime(date_str) == dt