Commit 9d115225 authored by Alex Gaynor's avatar Alex Gaynor
Browse files

Removed some more unused local vars

parent c687bf06
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -696,7 +696,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin):

            # Assigning polygon's exterior ring w/the new shell
            poly.exterior_ring = new_shell
            s = str(new_shell) # new shell is still accessible
            str(new_shell) # new shell is still accessible
            self.assertEqual(poly.exterior_ring, new_shell)
            self.assertEqual(poly[0], new_shell)

+13 −13
Original line number Diff line number Diff line
@@ -2435,7 +2435,7 @@ class AdminActionsTest(TestCase):
            'action': 'external_mail',
            'index': 0,
        }
        response = self.client.post('/test_admin/admin/admin_views/externalsubscriber/', action_data)
        self.client.post('/test_admin/admin/admin_views/externalsubscriber/', action_data)
        self.assertEqual(len(mail.outbox), 1)
        self.assertEqual(mail.outbox[0].subject, 'Greetings from a function action')

@@ -3679,10 +3679,10 @@ class RawIdFieldsTest(TestCase):
    def test_limit_choices_to(self):
        """Regression test for 14880"""
        actor = Actor.objects.create(name="Palin", age=27)
        inquisition1 = Inquisition.objects.create(expected=True,
        Inquisition.objects.create(expected=True,
                                   leader=actor,
                                   country="England")
        inquisition2 = Inquisition.objects.create(expected=False,
        Inquisition.objects.create(expected=False,
                                   leader=actor,
                                   country="Spain")
        response = self.client.get('/test_admin/admin/admin_views/sketch/add/')
@@ -3872,7 +3872,7 @@ class GroupAdminTest(TestCase):
            'name': 'newgroup',
        })

        new_group = Group.objects.order_by('-id')[0]
        Group.objects.order_by('-id')[0]
        self.assertRedirects(response, '/test_admin/admin/auth/group/')
        self.assertEqual(Group.objects.count(), group_count + 1)

@@ -4229,7 +4229,7 @@ class AdminCustomSaveRelatedTests(TestCase):
            'child_set-0-name': 'Paul',
            'child_set-1-name': 'Catherine',
        }
        response = self.client.post('/test_admin/admin/admin_views/parent/add/', post)
        self.client.post('/test_admin/admin/admin_views/parent/add/', post)
        self.assertEqual(1, Parent.objects.count())
        self.assertEqual(2, Child.objects.count())

@@ -4251,7 +4251,7 @@ class AdminCustomSaveRelatedTests(TestCase):
            'child_set-1-name': 'Catherine',
            'child_set-1-id': catherine.id,
        }
        response = self.client.post('/test_admin/admin/admin_views/parent/%s/' % parent.id, post)
        self.client.post('/test_admin/admin/admin_views/parent/%s/' % parent.id, post)

        children_names = list(Child.objects.order_by('name').values_list('name', flat=True))

@@ -4260,8 +4260,8 @@ class AdminCustomSaveRelatedTests(TestCase):

    def test_should_be_able_to_edit_related_objects_on_changelist_view(self):
        parent = Parent.objects.create(name='Josh Rock')
        paul = Child.objects.create(parent=parent, name='Paul')
        catherine = Child.objects.create(parent=parent, name='Catherine')
        Child.objects.create(parent=parent, name='Paul')
        Child.objects.create(parent=parent, name='Catherine')
        post = {
            'form-TOTAL_FORMS': '1',
            'form-INITIAL_FORMS': '1',
@@ -4271,7 +4271,7 @@ class AdminCustomSaveRelatedTests(TestCase):
            '_save': 'Save'
        }

        response = self.client.post('/test_admin/admin/admin_views/parent/', post)
        self.client.post('/test_admin/admin/admin_views/parent/', post)
        children_names = list(Child.objects.order_by('name').values_list('name', flat=True))

        self.assertEqual('Josh Stone', Parent.objects.latest('id').name)
+9 −9
Original line number Diff line number Diff line
@@ -531,11 +531,11 @@ class ModelTest(TestCase):
    def test_year_lookup_edge_case(self):
        # Edge-case test: A year lookup should retrieve all objects in
        # the given year, including Jan. 1 and Dec. 31.
        a11 = Article.objects.create(
        Article.objects.create(
            headline='Article 11',
            pub_date=datetime(2008, 1, 1),
        )
        a12 = Article.objects.create(
        Article.objects.create(
            headline='Article 12',
            pub_date=datetime(2008, 12, 31, 23, 59, 59, 999999),
        )
@@ -591,15 +591,15 @@ class ModelTest(TestCase):
    def test_extra_method_select_argument_with_dashes_and_values(self):
        # The 'select' argument to extra() supports names with dashes in
        # them, as long as you use values().
        a10 = Article.objects.create(
        Article.objects.create(
            headline="Article 10",
            pub_date=datetime(2005, 7, 31, 12, 30, 45),
        )
        a11 = Article.objects.create(
        Article.objects.create(
            headline='Article 11',
            pub_date=datetime(2008, 1, 1),
        )
        a12 = Article.objects.create(
        Article.objects.create(
            headline='Article 12',
            pub_date=datetime(2008, 12, 31, 23, 59, 59, 999999),
        )
@@ -615,15 +615,15 @@ class ModelTest(TestCase):
        # If you use 'select' with extra() and names containing dashes on a
        # query that's *not* a values() query, those extra 'select' values
        # will silently be ignored.
        a10 = Article.objects.create(
        Article.objects.create(
            headline="Article 10",
            pub_date=datetime(2005, 7, 31, 12, 30, 45),
        )
        a11 = Article.objects.create(
        Article.objects.create(
            headline='Article 11',
            pub_date=datetime(2008, 1, 1),
        )
        a12 = Article.objects.create(
        Article.objects.create(
            headline='Article 12',
            pub_date=datetime(2008, 12, 31, 23, 59, 59, 999999),
        )
@@ -640,7 +640,7 @@ class ModelTest(TestCase):
        """
        notlazy = 'test'
        lazy = ugettext_lazy(notlazy)
        reporter = Article.objects.create(headline=lazy, pub_date=datetime.now())
        Article.objects.create(headline=lazy, pub_date=datetime.now())
        article = Article.objects.get()
        self.assertEqual(article.headline, notlazy)
        # test that assign + save works with Promise objecs
+4 −4
Original line number Diff line number Diff line
@@ -310,7 +310,7 @@ class BaseCacheTests(object):
        # Don't want fields with callable as default to be called on cache write
        expensive_calculation.num_runs = 0
        Poll.objects.all().delete()
        my_poll = Poll.objects.create(question="What?")
        Poll.objects.create(question="What?")
        self.assertEqual(expensive_calculation.num_runs, 1)
        defer_qs = Poll.objects.all().defer('question')
        self.assertEqual(defer_qs.count(), 1)
@@ -323,14 +323,14 @@ class BaseCacheTests(object):
        # Don't want fields with callable as default to be called on cache read
        expensive_calculation.num_runs = 0
        Poll.objects.all().delete()
        my_poll = Poll.objects.create(question="What?")
        Poll.objects.create(question="What?")
        self.assertEqual(expensive_calculation.num_runs, 1)
        defer_qs = Poll.objects.all().defer('question')
        self.assertEqual(defer_qs.count(), 1)
        self.cache.set('deferred_queryset', defer_qs)
        self.assertEqual(expensive_calculation.num_runs, 1)
        runs_before_cache_read = expensive_calculation.num_runs
        cached_polls = self.cache.get('deferred_queryset')
        self.cache.get('deferred_queryset')
        # We only want the default expensive calculation run on creation and set
        self.assertEqual(expensive_calculation.num_runs, runs_before_cache_read)

@@ -1776,7 +1776,7 @@ class CacheMiddlewareTest(IgnoreDeprecationWarningsMixin, TestCase):
        time.sleep(2)

        # ... the default cache will still hit
        cache = get_cache('default')
        get_cache('default')
        response = default_view(request, '11')
        self.assertEqual(response.content, b'Hello World 1')

+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ class CommentAppAPITests(CommentTestCase):
    )
    def testGetMissingCommentApp(self):
        with six.assertRaisesRegex(self, ImproperlyConfigured, 'missing_app'):
            _ = comments.get_comment_app()
            comments.get_comment_app()

    def testGetForm(self):
        self.assertEqual(comments.get_form(), CommentForm)
Loading