diff --git a/vote/tests.py b/vote/tests.py index e1b0b54a1b23b9ade4e01340c7c57c8087b3d624..c4e3e24f4721399b332ce01b6fd0c0e4720d71b9 100644 --- a/vote/tests.py +++ b/vote/tests.py @@ -28,7 +28,8 @@ class VoterTestCase(TestCase): class ElectionSelectorsTest(TestCase): def test_election_selectors(self) -> None: - now = datetime(year=2021, month=4, day=1, tzinfo=timezone.get_fixed_timezone(5)) + now = datetime(year=2021, month=4, day=1, + tzinfo=timezone.get_fixed_timezone(5)) before = now - timedelta(seconds=5) bbefore = now - timedelta(seconds=10) after = now + timedelta(seconds=5) @@ -37,12 +38,16 @@ class ElectionSelectorsTest(TestCase): session = Session.objects.create(title="TEST") # upcoming elections all_upcoming = set() - all_upcoming.add(Election.objects.create(session=session, result_published=False)) - all_upcoming.add(Election.objects.create(session=session, start_date=after, result_published=False)) + all_upcoming.add(Election.objects.create( + session=session, result_published=False)) + all_upcoming.add(Election.objects.create( + session=session, start_date=after, result_published=False)) # open elections all_opened = set() - all_opened.add(Election.objects.create(session=session, start_date=now, result_published=False)) - all_opened.add(Election.objects.create(session=session, start_date=before, end_date=after, result_published=False)) + all_opened.add(Election.objects.create(session=session, + start_date=now, result_published=False)) + all_opened.add(Election.objects.create( + session=session, start_date=before, end_date=after, result_published=False)) # published elections all_published = set() all_published.add(Election.objects.create(session=session, start_date=bbefore, end_date=before, @@ -51,8 +56,10 @@ class ElectionSelectorsTest(TestCase): result_published=True)) # closed (not published) elections all_closed = set() - all_closed.add(Election.objects.create(session=session, start_date=bbefore, end_date=before, result_published=False)) - all_closed.add(Election.objects.create(session=session, start_date=before, end_date=now, result_published=False)) + all_closed.add(Election.objects.create( + session=session, start_date=bbefore, end_date=before, result_published=False)) + all_closed.add(Election.objects.create( + session=session, start_date=before, end_date=now, result_published=False)) # test upcoming upcoming = upcoming_elections(session) @@ -70,13 +77,15 @@ class ElectionSelectorsTest(TestCase): published = published_elections(session) self.assertEqual(all_published, set(published)) for e in published: - self.assertTrue(e.started and e.closed and not e.is_open and e.result_published) + self.assertTrue( + e.started and e.closed and not e.is_open and e.result_published) # test closed closed = closed_elections(session) self.assertEqual(all_closed, set(closed)) for e in closed: - self.assertTrue(e.started and e.closed and not e.is_open and not e.result_published) + self.assertTrue( + e.started and e.closed and not e.is_open and not e.result_published) def gen_data():