Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 14, 2022
1 parent 5221a90 commit bc6f65c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
3 changes: 2 additions & 1 deletion django_celery_beat/utils.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Utilities."""
# -- XXX This module must not use translation as that causes
# -- a recursive loader import!
import time

from django.conf import settings
from django.utils import timezone
import time

is_aware = timezone.is_aware
# celery schedstate return None will make it not work
Expand Down
20 changes: 11 additions & 9 deletions t/unit/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import time
from datetime import datetime
from unittest import mock

from django.test import TestCase
from datetime import datetime
import time
from django.utils import timezone

from django_celery_beat import utils
from django.utils import timezone


class UtilsTest(TestCase):

Expand All @@ -22,7 +24,7 @@ def test_make_aware_use_tz_naive(self, mock_getattr, mock_is_naive, mock_localti
mock_localtime_2.return_value = time.struct_time([2022, 11, 6, 1, 15, 0, 0, 310, 0])
mock_make_aware.return_value = dt

self.assertEquals(utils.make_aware(dt), mock_localtime_2.return_value)
self.assertEqual(utils.make_aware(dt), mock_localtime_2.return_value)

mock_localtime_1.assert_not_called()
mock_make_aware.assert_called_with(dt, timezone.utc)
Expand All @@ -43,7 +45,7 @@ def test_make_aware_use_tz_not_naive(self, mock_getattr, mock_is_naive, mock_loc
mock_localtime_2.return_value = time.struct_time([2022, 11, 6, 1, 15, 0, 0, 310, 0])
mock_make_aware.return_value = dt

self.assertEquals(utils.make_aware(dt), mock_localtime_2.return_value)
self.assertEqual(utils.make_aware(dt), mock_localtime_2.return_value)

mock_localtime_1.assert_not_called()
mock_make_aware.assert_not_called()
Expand All @@ -64,7 +66,7 @@ def test_make_aware_not_use_tz_naive_dst(self, mock_getattr, mock_is_naive, mock
mock_localtime_1.return_value = time.struct_time([2022, 11, 6, 1, 15, 0, 0, 310, 1])
mock_make_aware.return_value = dt

self.assertEquals(utils.make_aware(dt), dt)
self.assertEqual(utils.make_aware(dt), dt)

mock_localtime_1.assert_called_with()
mock_make_aware.assert_called_with(dt, "America/Los_Angeles", is_dst=True)
Expand All @@ -85,7 +87,7 @@ def test_make_aware_not_use_tz_naive_not_dst(self, mock_getattr, mock_is_naive,
mock_localtime_1.return_value = time.struct_time([2022, 11, 6, 1, 15, 0, 0, 310, 0])
mock_make_aware.return_value = dt

self.assertEquals(utils.make_aware(dt), dt)
self.assertEqual(utils.make_aware(dt), dt)

mock_localtime_1.assert_called_with()
mock_make_aware.assert_called_with(dt, "America/Los_Angeles", is_dst=False)
Expand All @@ -106,7 +108,7 @@ def test_make_aware_not_use_tz_naive_negative_dst(self, mock_getattr, mock_is_na
mock_localtime_1.return_value = time.struct_time([2022, 11, 6, 1, 15, 0, 0, 310, -1])
mock_make_aware.return_value = dt

self.assertEquals(utils.make_aware(dt), dt)
self.assertEqual(utils.make_aware(dt), dt)

mock_localtime_1.assert_called_with()
mock_make_aware.assert_called_with(dt, "America/Los_Angeles", is_dst=None)
Expand All @@ -125,7 +127,7 @@ def test_make_aware_not_use_tz_not_naive_dst(self, mock_getattr, mock_is_naive,
mock_localtime_1.return_value = time.struct_time([2022, 11, 6, 1, 15, 0, 0, 310, 0])
mock_make_aware.return_value = dt

self.assertEquals(utils.make_aware(dt), dt)
self.assertEqual(utils.make_aware(dt), dt)

mock_localtime_1.assert_not_called()
mock_make_aware.assert_not_called()
Expand Down

0 comments on commit bc6f65c

Please sign in to comment.