grimboite/tests/test_models.py

14 lines
462 B
Python

"""Checks structure associated with articles."""
from datetime import date
from grnx.models import get_date_from_article_filename
def test_article_match_date():
"""Checks that a date can be extracted from a filename."""
assert get_date_from_article_filename('2018-09-01-test.md') == date(2018, 9, 1)
assert get_date_from_article_filename('2017-02-30-divinity-origin-sin.md') == None
assert get_date_from_article_filename('lynis.md') == None