summaryrefslogtreecommitdiff
path: root/tests/admin_views
diff options
context:
space:
mode:
authorNick Pope <nick@nickpope.me.uk>2022-02-22 09:29:38 +0000
committerGitHub <noreply@github.com>2022-02-22 10:29:38 +0100
commit847f46e9bf88964484c8b76a10af753ea1018311 (patch)
tree13aced534cbae373f47cce8fce1444ad0e8e01d3 /tests/admin_views
parent7ba6ebe9149ae38257d70100e8bfbfd0da189862 (diff)
downloaddjango-847f46e9bf88964484c8b76a10af753ea1018311.tar.gz
Removed redundant QuerySet.all() calls in docs and tests.
Most QuerySet methods are mapped onto the Manager and, in general, it isn't necessary to call .all() on the manager.
Diffstat (limited to 'tests/admin_views')
-rw-r--r--tests/admin_views/test_actions.py2
-rw-r--r--tests/admin_views/tests.py6
2 files changed, 4 insertions, 4 deletions
diff --git a/tests/admin_views/test_actions.py b/tests/admin_views/test_actions.py
index ec690f5692..0c209019f3 100644
--- a/tests/admin_views/test_actions.py
+++ b/tests/admin_views/test_actions.py
@@ -190,7 +190,7 @@ class AdminActionsTest(TestCase):
)
# SubscriberAdmin.delete_queryset() sets overridden to True.
self.assertIs(SubscriberAdmin.overridden, True)
- self.assertEqual(Subscriber.objects.all().count(), 0)
+ self.assertEqual(Subscriber.objects.count(), 0)
def test_delete_selected_uses_get_deleted_objects(self):
"""The delete_selected action uses ModelAdmin.get_deleted_objects()."""
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
index 4d26ad7023..0e4a6b10be 100644
--- a/tests/admin_views/tests.py
+++ b/tests/admin_views/tests.py
@@ -1478,7 +1478,7 @@ class AdminCustomTemplateTests(AdminViewBasicTestCase):
self.assertRedirects(
post, reverse("admin:admin_views_customarticle_changelist")
)
- self.assertEqual(CustomArticle.objects.all().count(), 1)
+ self.assertEqual(CustomArticle.objects.count(), 1)
article_pk = CustomArticle.objects.all()[0].pk
# Test custom delete, change, and object history templates
@@ -5668,7 +5668,7 @@ class SeleniumTests(AdminSeleniumTestCase):
# Save and check that everything is properly stored in the database
with self.wait_page_loaded():
self.selenium.find_element(By.XPATH, '//input[@value="Save"]').click()
- self.assertEqual(MainPrepopulated.objects.all().count(), 1)
+ self.assertEqual(MainPrepopulated.objects.count(), 1)
MainPrepopulated.objects.get(
name=" the mAin nÀMë and it's awεšomeıııİ",
pubdate="2012-02-18",
@@ -5677,7 +5677,7 @@ class SeleniumTests(AdminSeleniumTestCase):
slug2="option-two-the-main-name-and-its-awesomeiiii",
slug3="the-main-nàmë-and-its-awεšomeıııi",
)
- self.assertEqual(RelatedPrepopulated.objects.all().count(), 6)
+ self.assertEqual(RelatedPrepopulated.objects.count(), 6)
RelatedPrepopulated.objects.get(
name=" here is a sŤāÇkeð inline ! ",
pubdate="2011-12-17",