From f1b3ae553f0726b40b3f1e66aa91695bb054074d Mon Sep 17 00:00:00 2001 From: Leo Hemsted Date: Tue, 2 Apr 2019 11:52:37 +0100 Subject: [PATCH] add tests for get_london_midnight_in_utc with a date object we sometimes call it with a timestamp, but sometimes with just a date object. It works with both, lets add the tests to prove that --- tests/app/test_utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/app/test_utils.py b/tests/app/test_utils.py index 8f105b588..04d710af3 100644 --- a/tests/app/test_utils.py +++ b/tests/app/test_utils.py @@ -1,4 +1,4 @@ -from datetime import datetime +from datetime import datetime, date import pytest from freezegun import freeze_time @@ -15,6 +15,9 @@ from app.utils import ( (datetime(2016, 1, 15, 0, 30), datetime(2016, 1, 15, 0, 0)), (datetime(2016, 6, 15, 0, 0), datetime(2016, 6, 14, 23, 0)), (datetime(2016, 9, 15, 11, 59), datetime(2016, 9, 14, 23, 0)), + # works for both dates and datetimes + (date(2016, 1, 15), datetime(2016, 1, 15, 0, 0)), + (date(2016, 6, 15), datetime(2016, 6, 14, 23, 0)), ]) def test_get_london_midnight_in_utc_returns_expected_date(date, expected_date): assert get_london_midnight_in_utc(date) == expected_date