Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed some more unused local vars

  • Loading branch information...
commit 9d11522599bb9f9fd6ad22c15c6168a4f2ac9b4e 1 parent c687bf0
Alex Gaynor alex authored
2  django/contrib/gis/geos/tests/test_geos.py
View
@@ -696,7 +696,7 @@ def test_mutable_geometries(self):
# 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)
26 tests/admin_views/tests.py
View
@@ -2435,7 +2435,7 @@ def test_custom_function_mail_action(self):
'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,12 +3679,12 @@ def tearDown(self):
def test_limit_choices_to(self):
"""Regression test for 14880"""
actor = Actor.objects.create(name="Palin", age=27)
- inquisition1 = Inquisition.objects.create(expected=True,
- leader=actor,
- country="England")
- inquisition2 = Inquisition.objects.create(expected=False,
- leader=actor,
- country="Spain")
+ Inquisition.objects.create(expected=True,
+ leader=actor,
+ country="England")
+ Inquisition.objects.create(expected=False,
+ leader=actor,
+ country="Spain")
response = self.client.get('/test_admin/admin/admin_views/sketch/add/')
# Find the link
m = re.search(br'<a href="([^"]*)"[^>]* id="lookup_id_inquisition"', response.content)
@@ -3872,7 +3872,7 @@ def test_save_button(self):
'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 @@ def test_should_be_able_to_edit_related_objects_on_add_view(self):
'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 @@ def test_should_be_able_to_edit_related_objects_on_change_view(self):
'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 @@ def test_should_be_able_to_edit_related_objects_on_change_view(self):
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 @@ def test_should_be_able_to_edit_related_objects_on_changelist_view(self):
'_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)
18 tests/basic/tests.py
View
@@ -531,11 +531,11 @@ def test_create_method(self):
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 @@ def test_field_ordering(self):
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 @@ def test_extra_method_select_argument_with_dashes(self):
# 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 @@ def test_create_relation_with_ugettext_lazy(self):
"""
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
8 tests/cache/tests.py
View
@@ -310,7 +310,7 @@ def test_cache_write_for_model_instance_with_deferred(self):
# 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 @@ def test_cache_read_for_model_instance_with_deferred(self):
# 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 @@ def test_view_decorator(self):
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')
2  tests/comment_tests/tests/test_app_api.py
View
@@ -21,7 +21,7 @@ def testGetCommentApp(self):
)
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)
2  tests/comment_tests/tests/test_feeds.py
View
@@ -17,7 +17,7 @@ def setUp(self):
site_2 = Site.objects.create(id=settings.SITE_ID+1,
domain="example2.com", name="example2.com")
# A comment for another site
- c5 = Comment.objects.create(
+ Comment.objects.create(
content_type = ContentType.objects.get_for_model(Article),
object_pk = "1",
user_name = "Joe Somebody",
6 tests/comment_tests/tests/test_moderation_views.py
View
@@ -269,13 +269,13 @@ def setUp(self):
u.save()
def testActionsNonModerator(self):
- comments = self.createSomeComments()
+ self.createSomeComments()
self.client.login(username="normaluser", password="normaluser")
response = self.client.get("/admin/comments/comment/")
self.assertNotContains(response, "approve_comments")
def testActionsModerator(self):
- comments = self.createSomeComments()
+ self.createSomeComments()
makeModerator("normaluser")
self.client.login(username="normaluser", password="normaluser")
response = self.client.get("/admin/comments/comment/")
@@ -283,7 +283,7 @@ def testActionsModerator(self):
def testActionsDisabledDelete(self):
"Tests a CommentAdmin where 'delete_selected' has been disabled."
- comments = self.createSomeComments()
+ self.createSomeComments()
self.client.login(username="normaluser", password="normaluser")
response = self.client.get('/admin2/comments/comment/')
self.assertEqual(response.status_code, 200)
2  tests/csrf_tests/tests.py
View
@@ -376,7 +376,7 @@ def emit(self, record):
logger.setLevel(logging.WARNING)
req = self._get_GET_no_csrf_cookie_request()
- resp = view(req)
+ view(req)
finally:
logger.removeHandler(test_handler)
logger.setLevel(old_log_level)
8 tests/custom_managers/tests.py
View
@@ -8,7 +8,7 @@
class CustomManagerTests(TestCase):
def test_manager(self):
- p1 = Person.objects.create(first_name="Bugs", last_name="Bunny", fun=True)
+ Person.objects.create(first_name="Bugs", last_name="Bunny", fun=True)
p2 = Person.objects.create(first_name="Droopy", last_name="Dog", fun=False)
# Test a custom `Manager` method.
@@ -63,7 +63,7 @@ def test_manager(self):
# manager
self.assertIsInstance(p2.books, PublishedBookManager)
- b1 = Book.published_objects.create(
+ Book.published_objects.create(
title="How to program", author="Rodney Dangerfield", is_published=True
)
b2 = Book.published_objects.create(
@@ -85,8 +85,8 @@ def test_manager(self):
lambda b: b.title
)
- c1 = Car.cars.create(name="Corvette", mileage=21, top_speed=180)
- c2 = Car.cars.create(name="Neon", mileage=31, top_speed=100)
+ Car.cars.create(name="Corvette", mileage=21, top_speed=180)
+ Car.cars.create(name="Neon", mileage=31, top_speed=100)
self.assertQuerysetEqual(
Car.cars.order_by("name"), [
4 tests/custom_pk/tests.py
View
@@ -141,12 +141,12 @@ def test_custom_pk(self):
def test_unicode_pk(self):
# Primary key may be unicode string
- bus = Business.objects.create(name='jaźń')
+ Business.objects.create(name='jaźń')
def test_unique_pk(self):
# The primary key must also obviously be unique, so trying to create a
# new object with the same primary key will fail.
- e = Employee.objects.create(
+ Employee.objects.create(
employee_code=123, first_name="Frank", last_name="Jones"
)
sid = transaction.savepoint()
6 tests/datatypes/tests.py
View
@@ -47,10 +47,10 @@ def test_time_field(self):
def test_year_boundaries(self):
"""Year boundary tests (ticket #3689)"""
- d = Donut.objects.create(name='Date Test 2007',
+ Donut.objects.create(name='Date Test 2007',
baked_date=datetime.datetime(year=2007, month=12, day=31),
consumed_at=datetime.datetime(year=2007, month=12, day=31, hour=23, minute=59, second=59))
- d1 = Donut.objects.create(name='Date Test 2006',
+ Donut.objects.create(name='Date Test 2006',
baked_date=datetime.datetime(year=2006, month=1, day=1),
consumed_at=datetime.datetime(year=2006, month=1, day=1))
@@ -60,7 +60,7 @@ def test_year_boundaries(self):
self.assertEqual("Date Test 2006",
Donut.objects.filter(baked_date__year=2006)[0].name)
- d2 = Donut.objects.create(name='Apple Fritter',
+ Donut.objects.create(name='Apple Fritter',
consumed_at = datetime.datetime(year=2007, month=4, day=20, hour=16, minute=19, second=59))
self.assertEqual(['Apple Fritter', 'Date Test 2007'],
6 tests/delete/tests.py
View
@@ -216,8 +216,8 @@ def log_pre_delete(sender, **kwargs):
r = R.objects.create(pk=1)
s1 = S.objects.create(pk=1, r=r)
s2 = S.objects.create(pk=2, r=r)
- t1 = T.objects.create(pk=1, s=s1)
- t2 = T.objects.create(pk=2, s=s2)
+ T.objects.create(pk=1, s=s1)
+ T.objects.create(pk=2, s=s2)
r.delete()
self.assertEqual(
pre_delete_order, [(T, 2), (T, 1), (S, 2), (S, 1), (R, 1)]
@@ -302,7 +302,7 @@ def noop(*args, **kwargs):
def test_hidden_related(self):
r = R.objects.create()
h = HiddenUser.objects.create(r=r)
- p = HiddenUserProfile.objects.create(user=h)
+ HiddenUserProfile.objects.create(user=h)
r.delete()
self.assertEqual(HiddenUserProfile.objects.count(), 0)
14 tests/delete_regress/tests.py
View
@@ -73,8 +73,8 @@ def test_generic_relation_cascade(self):
"""
person = Person.objects.create(name='Nelson Mandela')
award = Award.objects.create(name='Nobel', content_object=person)
- note = AwardNote.objects.create(note='a peace prize',
- award=award)
+ AwardNote.objects.create(note='a peace prize',
+ award=award)
self.assertEqual(AwardNote.objects.count(), 1)
person.delete()
self.assertEqual(Award.objects.count(), 0)
@@ -93,8 +93,8 @@ def test_fk_to_m2m_through(self):
paints = Toy.objects.create(name='Paints')
played = PlayedWith.objects.create(child=juan, toy=paints,
date=datetime.date.today())
- note = PlayedWithNote.objects.create(played=played,
- note='the next Jackson Pollock')
+ PlayedWithNote.objects.create(played=played,
+ note='the next Jackson Pollock')
self.assertEqual(PlayedWithNote.objects.count(), 1)
paints.delete()
self.assertEqual(PlayedWith.objects.count(), 0)
@@ -105,7 +105,7 @@ def test_15776(self):
policy = Policy.objects.create(pk=1, policy_number="1234")
version = Version.objects.create(policy=policy)
location = Location.objects.create(version=version)
- item = Item.objects.create(version=version, location=location)
+ Item.objects.create(version=version, location=location)
policy.delete()
@@ -135,7 +135,7 @@ def test_to_field(self):
"""
apple = Food.objects.create(name="apple")
- eaten = Eaten.objects.create(food=apple, meal="lunch")
+ Eaten.objects.create(food=apple, meal="lunch")
apple.delete()
self.assertFalse(Food.objects.exists())
@@ -146,7 +146,7 @@ class LargeDeleteTests(TestCase):
def test_large_deletes(self):
"Regression for #13309 -- if the number of objects > chunk size, deletion still occurs"
for x in range(300):
- track = Book.objects.create(pagecount=x+100)
+ Book.objects.create(pagecount=x+100)
# attach a signal to make sure we will not fast-delete
def noop(*args, **kwargs):
pass
8 tests/distinct_on_fields/tests.py
View
@@ -9,15 +9,15 @@
class DistinctOnTests(TestCase):
def setUp(self):
t1 = Tag.objects.create(name='t1')
- t2 = Tag.objects.create(name='t2', parent=t1)
+ Tag.objects.create(name='t2', parent=t1)
t3 = Tag.objects.create(name='t3', parent=t1)
- t4 = Tag.objects.create(name='t4', parent=t3)
- t5 = Tag.objects.create(name='t5', parent=t3)
+ Tag.objects.create(name='t4', parent=t3)
+ Tag.objects.create(name='t5', parent=t3)
p1_o1 = Staff.objects.create(id=1, name="p1", organisation="o1")
p2_o1 = Staff.objects.create(id=2, name="p2", organisation="o1")
p3_o1 = Staff.objects.create(id=3, name="p3", organisation="o1")
- p1_o2 = Staff.objects.create(id=4, name="p1", organisation="o2")
+ Staff.objects.create(id=4, name="p1", organisation="o2")
p1_o1.coworkers.add(p2_o1, p3_o1)
StaffTag.objects.create(staff=p1_o1, tag=t1)
StaffTag.objects.create(staff=p1_o1, tag=t1)
Please sign in to comment.
Something went wrong with that request. Please try again.