summaryrefslogtreecommitdiff
path: root/tests/generic_views/test_dates.py
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2016-06-16 11:19:18 -0700
committerTim Graham <timograham@gmail.com>2016-06-16 14:19:18 -0400
commit4f336f66523001b009ab038b10848508fd208b3b (patch)
tree47474fb588013f1770246455ef7aa1a4163a1edb /tests/generic_views/test_dates.py
parentea34426ae789d31b036f58c8fd59ce299649e91e (diff)
Fixed #26747 -- Used more specific assertions in the Django test suite.
Diffstat (limited to 'tests/generic_views/test_dates.py')
-rw-r--r--tests/generic_views/test_dates.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/generic_views/test_dates.py b/tests/generic_views/test_dates.py
index 3b34a4caee..af7a04c9a6 100644
--- a/tests/generic_views/test_dates.py
+++ b/tests/generic_views/test_dates.py
@@ -166,7 +166,7 @@ class YearArchiveViewTests(TestDataMixin, TestCase):
self.assertTemplateUsed(res, 'generic_views/book_archive_year.html')
# Since allow_empty=False, next/prev years must be valid (#7164)
- self.assertEqual(res.context['next_year'], None)
+ self.assertIsNone(res.context['next_year'])
self.assertEqual(res.context['previous_year'], datetime.date(2006, 1, 1))
def test_year_view_make_object_list(self):
@@ -287,7 +287,7 @@ class MonthArchiveViewTests(TestDataMixin, TestCase):
self.assertEqual(res.context['month'], datetime.date(2008, 10, 1))
# Since allow_empty=False, next/prev months must be valid (#7164)
- self.assertEqual(res.context['next_month'], None)
+ self.assertIsNone(res.context['next_month'])
self.assertEqual(res.context['previous_month'], datetime.date(2006, 5, 1))
def test_month_view_allow_empty(self):
@@ -310,7 +310,7 @@ class MonthArchiveViewTests(TestDataMixin, TestCase):
url = datetime.date.today().strftime('/dates/books/%Y/%b/allow_empty/').lower()
res = self.client.get(url)
self.assertEqual(res.status_code, 200)
- self.assertEqual(res.context['next_month'], None)
+ self.assertIsNone(res.context['next_month'])
def test_month_view_allow_future(self):
future = (datetime.date.today() + datetime.timedelta(days=60)).replace(day=1)
@@ -330,7 +330,7 @@ class MonthArchiveViewTests(TestDataMixin, TestCase):
# Since allow_future = True but not allow_empty, next/prev are not
# allowed to be empty months (#7164)
- self.assertEqual(res.context['next_month'], None)
+ self.assertIsNone(res.context['next_month'])
self.assertEqual(res.context['previous_month'], datetime.date(2008, 10, 1))
# allow_future, but not allow_empty, with a current month. So next
@@ -417,7 +417,7 @@ class WeekArchiveViewTests(TestDataMixin, TestCase):
self.assertEqual(res.context['week'], datetime.date(2008, 9, 28))
# Since allow_empty=False, next/prev weeks must be valid
- self.assertEqual(res.context['next_week'], None)
+ self.assertIsNone(res.context['next_week'])
self.assertEqual(res.context['previous_week'], datetime.date(2006, 4, 30))
def test_week_view_allow_empty(self):
@@ -439,7 +439,7 @@ class WeekArchiveViewTests(TestDataMixin, TestCase):
url = datetime.date.today().strftime('/dates/books/%Y/week/%U/allow_empty/').lower()
res = self.client.get(url)
self.assertEqual(res.status_code, 200)
- self.assertEqual(res.context['next_week'], None)
+ self.assertIsNone(res.context['next_week'])
def test_week_view_allow_future(self):
# January 7th always falls in week 1, given Python's definition of week numbers
@@ -457,7 +457,7 @@ class WeekArchiveViewTests(TestDataMixin, TestCase):
# Since allow_future = True but not allow_empty, next/prev are not
# allowed to be empty weeks
- self.assertEqual(res.context['next_week'], None)
+ self.assertIsNone(res.context['next_week'])
self.assertEqual(res.context['previous_week'], datetime.date(2008, 9, 28))
# allow_future, but not allow_empty, with a current week. So next
@@ -520,7 +520,7 @@ class DayArchiveViewTests(TestDataMixin, TestCase):
self.assertEqual(res.context['day'], datetime.date(2008, 10, 1))
# Since allow_empty=False, next/prev days must be valid.
- self.assertEqual(res.context['next_day'], None)
+ self.assertIsNone(res.context['next_day'])
self.assertEqual(res.context['previous_day'], datetime.date(2006, 5, 1))
def test_day_view_allow_empty(self):
@@ -542,7 +542,7 @@ class DayArchiveViewTests(TestDataMixin, TestCase):
url = datetime.date.today().strftime('/dates/books/%Y/%b/%d/allow_empty/').lower()
res = self.client.get(url)
self.assertEqual(res.status_code, 200)
- self.assertEqual(res.context['next_day'], None)
+ self.assertIsNone(res.context['next_day'])
def test_day_view_allow_future(self):
future = (datetime.date.today() + datetime.timedelta(days=60))
@@ -560,7 +560,7 @@ class DayArchiveViewTests(TestDataMixin, TestCase):
self.assertEqual(res.context['day'], future)
# allow_future but not allow_empty, next/prev must be valid
- self.assertEqual(res.context['next_day'], None)
+ self.assertIsNone(res.context['next_day'])
self.assertEqual(res.context['previous_day'], datetime.date(2008, 10, 1))
# allow_future, but not allow_empty, with a current month.