This commit is contained in:
Luke Tainton (ltainton)
2023-04-05 20:57:31 +01:00
parent be6546e4cc
commit 102b74e90a
21 changed files with 409 additions and 13 deletions

20
tests/test_datetime.py Normal file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env python3
"""Provides test cases for app/utils/datetime.py."""
import pytest
from app.utils.datetime import timestamp_to_date # pragma: no cover
def test_correct() -> None:
timestamp: int = 1680722218
result: str = timestamp_to_date(timestamp)
assert result == "2023-04-05"
def test_invalid() -> None:
timestamp: str = "hello"
with pytest.raises(TypeError) as excinfo:
timestamp_to_date(timestamp)
assert "'str' object cannot be interpreted as an integer" in str(excinfo.value)