Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

PEP 8 cleanup

  • Loading branch information...
commit 8c5b805ca11ff25ffa8a4efd0781efe5cc872de3 1 parent bb863fa
@akaariai akaariai authored
Showing with 15 additions and 12 deletions.
  1. +15 −12 tests/generic_relations_regress/tests.py
View
27 tests/generic_relations_regress/tests.py
@@ -2,7 +2,8 @@
from django.db.utils import IntegrityError
from django.test import TestCase, skipIfDBFeature
-from .models import (Address, Place, Restaurant, Link, CharLink, TextLink,
+from .models import (
+ Address, Place, Restaurant, Link, CharLink, TextLink,
Person, Contact, Note, Organization, OddRelation1, OddRelation2, Company,
Developer, Team, Guild, Tag, Board, HasLinkThing)
@@ -28,9 +29,9 @@ def test_reverse_relation_pk(self):
originating model of a query. See #12664.
"""
p = Person.objects.create(account=23, name='Chef')
- a = Address.objects.create(street='123 Anywhere Place',
- city='Conifer', state='CO',
- zipcode='80433', content_object=p)
+ Address.objects.create(street='123 Anywhere Place',
+ city='Conifer', state='CO',
+ zipcode='80433', content_object=p)
qs = Person.objects.filter(addresses__zipcode='80433')
self.assertEqual(1, qs.count())
@@ -38,12 +39,12 @@ def test_reverse_relation_pk(self):
def test_charlink_delete(self):
oddrel = OddRelation1.objects.create(name='clink')
- cl = CharLink.objects.create(content_object=oddrel)
+ CharLink.objects.create(content_object=oddrel)
oddrel.delete()
def test_textlink_delete(self):
oddrel = OddRelation2.objects.create(name='tlink')
- tl = TextLink.objects.create(content_object=oddrel)
+ TextLink.objects.create(content_object=oddrel)
oddrel.delete()
def test_q_object_or(self):
@@ -61,12 +62,12 @@ def test_q_object_or(self):
"""
note_contact = Contact.objects.create()
org_contact = Contact.objects.create()
- note = Note.objects.create(note='note', content_object=note_contact)
+ Note.objects.create(note='note', content_object=note_contact)
org = Organization.objects.create(name='org name')
org.contacts.add(org_contact)
# search with a non-matching note and a matching org name
qs = Contact.objects.filter(Q(notes__note__icontains=r'other note') |
- Q(organizations__name__icontains=r'org name'))
+ Q(organizations__name__icontains=r'org name'))
self.assertTrue(org_contact in qs)
# search again, with the same query parameters, in reverse order
qs = Contact.objects.filter(
@@ -90,8 +91,8 @@ def test_generic_relation_ordering(self):
p1 = Place.objects.create(name="South Park")
p2 = Place.objects.create(name="The City")
c = Company.objects.create(name="Chubby's Intl.")
- l1 = Link.objects.create(content_object=p1)
- l2 = Link.objects.create(content_object=c)
+ Link.objects.create(content_object=p1)
+ Link.objects.create(content_object=c)
places = list(Place.objects.order_by('links__id'))
def count_places(place):
@@ -114,8 +115,10 @@ def test_target_model_len_zero(self):
try:
note = Note(note='Deserve a bonus', content_object=team1)
except Exception as e:
- if issubclass(type(e), Exception) and str(e) == 'Impossible arguments to GFK.get_content_type!':
- self.fail("Saving model with GenericForeignKey to model instance whose __len__ method returns 0 shouldn't fail.")
+ if (issubclass(type(e), Exception) and
+ str(e) == 'Impossible arguments to GFK.get_content_type!'):
+ self.fail("Saving model with GenericForeignKey to model instance whose "
+ "__len__ method returns 0 shouldn't fail.")
raise e
note.save()
Please sign in to comment.
Something went wrong with that request. Please try again.