From a2ea0db3939a80a4f1c52330d2d365b0e740c188 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 10 Oct 2016 13:10:53 +0100 Subject: [PATCH] Make test easier to read MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Explicity labelling what the numbers mean makes it easier to understand what’s going on rather than having to refer back to the function call. --- tests/app/dao/test_jobs_dao.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/tests/app/dao/test_jobs_dao.py b/tests/app/dao/test_jobs_dao.py index e9b4a2376..af40d995d 100644 --- a/tests/app/dao/test_jobs_dao.py +++ b/tests/app/dao/test_jobs_dao.py @@ -196,21 +196,13 @@ def test_get_jobs_for_service_with_limit_days_edge_case(notify_db, notify_db_ses def test_get_jobs_for_service_in_processed_at_then_created_at_order(notify_db, notify_db_session, sample_template): _create_job = partial(create_job, notify_db, notify_db_session, sample_template.service, sample_template) - - def _time_from_hour(hour): - return datetime(2001, 1, 1, hour) if hour is not None else None + from_hour = partial(datetime, 2001, 1, 1) created_jobs = [ - _create_job( - created_at=_time_from_hour(created_at_hour), - processing_started=_time_from_hour(processing_started_hour), - ) - for created_at_hour, processing_started_hour in [ - (2, None), - (1, None), - (1, 4), - (4, 3), - ] + _create_job(created_at=from_hour(2), processing_started=None), + _create_job(created_at=from_hour(1), processing_started=None), + _create_job(created_at=from_hour(1), processing_started=from_hour(4)), + _create_job(created_at=from_hour(4), processing_started=from_hour(3)), ] jobs = dao_get_jobs_by_service_id(sample_template.service.id).items