Skip to content

Commit 6fdd09b

Browse files
authored
Fixed test_week() when first Sunday of the year is on January, 7th.
1 parent 615de0f commit 6fdd09b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tests/test_managers.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
import calendar
12
from datetime import date, timedelta
23

4+
from dateutil.relativedelta import relativedelta
35
from django.contrib.auth import get_user_model
46
from django.test import TestCase, override_settings
57
from django.utils.timezone import now
@@ -119,7 +121,9 @@ def test_month_is_not_december(self):
119121

120122
def test_week(self):
121123
# setUp
122-
january_time = now().replace(month=1, day=6)
124+
january_time = now().replace(month=1, day=1)
125+
# Move to the first week starting on the first Sunday of the year.
126+
january_time += relativedelta(weekday=calendar.SUNDAY)
123127
self.request.time = january_time
124128
self.request.save()
125129
# Test

0 commit comments

Comments
 (0)