1- from datetime import date , datetime , timedelta
1+ from datetime import date , datetime
22
3- from dateutil .relativedelta import relativedelta
43from freezegun import freeze_time
54
6- from ...counters .resets import _daily , _monthly , _monthly_subscription , _never , _timestamp , _today , _weekly
5+ from ...counters .resets import (
6+ _daily ,
7+ _monthly ,
8+ _monthly_subscription ,
9+ _never ,
10+ _timestamp ,
11+ _today ,
12+ _weekly ,
13+ )
714from ..mixins import BaseTestCase
815
916
@@ -18,7 +25,7 @@ def test_timestamp_function(self):
1825 start = datetime (2021 , 11 , 3 , 0 , 0 , 0 )
1926 end = datetime (2021 , 11 , 4 , 0 , 0 , 0 )
2027 start_ts , end_ts = _timestamp (start , end )
21-
28+
2229 self .assertIsInstance (start_ts , int )
2330 self .assertIsInstance (end_ts , int )
2431 self .assertEqual (start_ts , int (start .timestamp ()))
@@ -63,7 +70,7 @@ def test_monthly_subscription_same_month(self):
6370 user = self ._get_user ()
6471 user .date_joined = datetime .fromisoformat ("2021-07-02 12:34:58" )
6572 user .save (update_fields = ["date_joined" ])
66-
73+
6774 start , end = _monthly_subscription (user )
6875 self .assertIsInstance (start , int )
6976 self .assertIsInstance (end , int )
@@ -75,7 +82,7 @@ def test_monthly_subscription_prev_month(self):
7582 user = self ._get_user ()
7683 user .date_joined = datetime .fromisoformat ("2021-07-22 12:34:58" )
7784 user .save (update_fields = ["date_joined" ])
78-
85+
7986 start , end = _monthly_subscription (user )
8087 self .assertEqual (str (datetime .fromtimestamp (start )), "2021-10-22 00:00:00" )
8188 self .assertEqual (str (datetime .fromtimestamp (start )), "2021-10-22 00:00:00" )
@@ -86,7 +93,7 @@ def test_monthly_subscription_future_day(self):
8693 user = self ._get_user ()
8794 user .date_joined = datetime .fromisoformat ("2021-07-25 12:34:58" )
8895 user .save (update_fields = ["date_joined" ])
89-
96+
9097 start , end = _monthly_subscription (user )
9198 self .assertEqual (str (datetime .fromtimestamp (start )), "2021-10-25 00:00:00" )
9299 self .assertEqual (str (datetime .fromtimestamp (end )), "2021-11-25 00:00:00" )
@@ -96,7 +103,7 @@ def test_monthly_subscription_with_kwargs(self):
96103 user = self ._get_user ()
97104 user .date_joined = datetime .fromisoformat ("2021-07-15 12:00:00" )
98105 user .save (update_fields = ["date_joined" ])
99-
106+
100107 start , end = _monthly_subscription (user , counter = None )
101108 self .assertIsInstance (start , int )
102109 self .assertIsInstance (end , int )
0 commit comments