diff options
| author | django-bot <ops@djangoproject.com> | 2025-07-22 20:41:41 -0700 |
|---|---|---|
| committer | nessita <124304+nessita@users.noreply.github.com> | 2025-07-23 20:17:55 -0300 |
| commit | 69a93a88edb56ba47f624dac7a21aacc47ea474f (patch) | |
| tree | f57507a4435d032493cae40e06ecb254790b67b2 /tests/generic_views | |
| parent | 55b0cc21310b76ce4018dd793ba50556eaf0af06 (diff) | |
Refs #36500 -- Rewrapped long docstrings and block comments via a script.
Rewrapped long docstrings and block comments to 79 characters + newline
using script from https://github.com/medmunds/autofix-w505.
Diffstat (limited to 'tests/generic_views')
| -rw-r--r-- | tests/generic_views/test_base.py | 9 | ||||
| -rw-r--r-- | tests/generic_views/test_dates.py | 18 | ||||
| -rw-r--r-- | tests/generic_views/test_list.py | 3 |
3 files changed, 20 insertions, 10 deletions
diff --git a/tests/generic_views/test_base.py b/tests/generic_views/test_base.py index acd938935a..cc5dcf4e39 100644 --- a/tests/generic_views/test_base.py +++ b/tests/generic_views/test_base.py @@ -114,7 +114,8 @@ class ViewTest(LoggingAssertionMixin, SimpleTestCase): def test_get_and_head(self): """ - Test a view which supplies a GET method also responds correctly to HEAD. + Test a view which supplies a GET method also responds correctly to + HEAD. """ self._assert_simple(SimpleView.as_view()(self.rf.get("/"))) response = SimpleView.as_view()(self.rf.head("/")) @@ -129,7 +130,8 @@ class ViewTest(LoggingAssertionMixin, SimpleTestCase): def test_head_no_get(self): """ - Test a view which supplies no GET method responds to HEAD with HTTP 405. + Test a view which supplies no GET method responds to HEAD with HTTP + 405. """ response = PostOnlyView.as_view()(self.rf.head("/")) self.assertEqual(response.status_code, 405) @@ -608,7 +610,8 @@ class GetContextDataTest(SimpleTestCase): self.assertEqual(context["pony"], test_view.object) def test_object_in_get_context_data(self): - # Checks 'object' key presence in dict returned by get_context_date #20234 + # Checks 'object' key presence in dict returned by get_context_date + # #20234 test_view = views.CustomSingleObjectView() context = test_view.get_context_data() self.assertEqual(context["object"], test_view.object) diff --git a/tests/generic_views/test_dates.py b/tests/generic_views/test_dates.py index cfed82a586..140083d315 100644 --- a/tests/generic_views/test_dates.py +++ b/tests/generic_views/test_dates.py @@ -137,7 +137,8 @@ class ArchiveIndexViewTests(TestDataMixin, TestCase): # 1 query for years list + 1 query for books with self.assertNumQueries(2): self.client.get("/dates/books/") - # same as above + 1 query to test if books exist + 1 query to count them + # same as above + 1 query to test if books exist + 1 query to count + # them with self.assertNumQueries(4): self.client.get("/dates/books/paginated/") @@ -242,7 +243,8 @@ class YearArchiveViewTests(TestDataMixin, TestCase): self.assertEqual(list(res.context["date_list"]), []) self.assertEqual(list(res.context["book_list"]), []) - # Since allow_empty=True, next/prev are allowed to be empty years (#7164) + # Since allow_empty=True, next/prev are allowed to be empty years + # (#7164) self.assertEqual(res.context["next_year"], datetime.date(2000, 1, 1)) self.assertEqual(res.context["previous_year"], datetime.date(1998, 1, 1)) @@ -409,7 +411,8 @@ class MonthArchiveViewTests(TestDataMixin, TestCase): self.assertEqual(list(res.context["book_list"]), []) self.assertEqual(res.context["month"], datetime.date(2000, 1, 1)) - # Since allow_empty=True, next/prev are allowed to be empty months (#7164) + # Since allow_empty=True, next/prev are allowed to be empty months + # (#7164) self.assertEqual(res.context["next_month"], datetime.date(2000, 2, 1)) self.assertEqual(res.context["previous_month"], datetime.date(1999, 12, 1)) @@ -484,7 +487,8 @@ class MonthArchiveViewTests(TestDataMixin, TestCase): res = self.client.get("/dates/books/2010/nov/") self.assertEqual(res.status_code, 200) self.assertEqual(res.context["previous_month"], datetime.date(2010, 10, 1)) - # The bug does not occur here because a Book with pubdate of Sep 1 exists + # The bug does not occur here because a Book with pubdate of Sep 1 + # exists res = self.client.get("/dates/books/2010/oct/") self.assertEqual(res.status_code, 200) self.assertEqual(res.context["previous_month"], datetime.date(2010, 9, 1)) @@ -578,7 +582,8 @@ class WeekArchiveViewTests(TestDataMixin, TestCase): 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 + # January 7th always falls in week 1, given Python's definition of week + # numbers future = datetime.date(datetime.date.today().year + 1, 1, 7) future_sunday = future - datetime.timedelta(days=(future.weekday() + 1) % 7) b = Book.objects.create(name="The New New Testement", pages=600, pubdate=future) @@ -696,7 +701,8 @@ class DayArchiveViewTests(TestDataMixin, TestCase): self.assertEqual(list(res.context["book_list"]), []) self.assertEqual(res.context["day"], datetime.date(2000, 1, 1)) - # Since it's allow empty, next/prev are allowed to be empty months (#7164) + # Since it's allow empty, next/prev are allowed to be empty months + # (#7164) self.assertEqual(res.context["next_day"], datetime.date(2000, 1, 2)) self.assertEqual(res.context["previous_day"], datetime.date(1999, 12, 31)) diff --git a/tests/generic_views/test_list.py b/tests/generic_views/test_list.py index 25f6553a8a..421609d76d 100644 --- a/tests/generic_views/test_list.py +++ b/tests/generic_views/test_list.py @@ -229,7 +229,8 @@ class ListViewTests(TestCase): # 1 query for authors with self.assertNumQueries(1): self.client.get("/list/authors/notempty/") - # same as above + 1 query to test if authors exist + 1 query for pagination + # same as above + 1 query to test if authors exist + 1 query for + # pagination with self.assertNumQueries(3): self.client.get("/list/authors/notempty/paginated/") |
