Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

PEP 8 cleanup

  • Loading branch information...
commit 8c5b805ca11ff25ffa8a4efd0781efe5cc872de3 1 parent bb863fa
Anssi Kääriäinen authored June 05, 2013

Showing 1 changed file with 15 additions and 12 deletions. Show diff stats Hide diff stats

  1. 27  tests/generic_relations_regress/tests.py
27  tests/generic_relations_regress/tests.py
@@ -2,7 +2,8 @@
2 2
 from django.db.utils import IntegrityError
3 3
 from django.test import TestCase, skipIfDBFeature
4 4
 
5  
-from .models import (Address, Place, Restaurant, Link, CharLink, TextLink,
  5
+from .models import (
  6
+    Address, Place, Restaurant, Link, CharLink, TextLink,
6 7
     Person, Contact, Note, Organization, OddRelation1, OddRelation2, Company,
7 8
     Developer, Team, Guild, Tag, Board, HasLinkThing)
8 9
 
@@ -28,9 +29,9 @@ def test_reverse_relation_pk(self):
28 29
         originating model of a query.  See #12664.
29 30
         """
30 31
         p = Person.objects.create(account=23, name='Chef')
31  
-        a = Address.objects.create(street='123 Anywhere Place',
32  
-                                   city='Conifer', state='CO',
33  
-                                   zipcode='80433', content_object=p)
  32
+        Address.objects.create(street='123 Anywhere Place',
  33
+                               city='Conifer', state='CO',
  34
+                               zipcode='80433', content_object=p)
34 35
 
35 36
         qs = Person.objects.filter(addresses__zipcode='80433')
36 37
         self.assertEqual(1, qs.count())
@@ -38,12 +39,12 @@ def test_reverse_relation_pk(self):
38 39
 
39 40
     def test_charlink_delete(self):
40 41
         oddrel = OddRelation1.objects.create(name='clink')
41  
-        cl = CharLink.objects.create(content_object=oddrel)
  42
+        CharLink.objects.create(content_object=oddrel)
42 43
         oddrel.delete()
43 44
 
44 45
     def test_textlink_delete(self):
45 46
         oddrel = OddRelation2.objects.create(name='tlink')
46  
-        tl = TextLink.objects.create(content_object=oddrel)
  47
+        TextLink.objects.create(content_object=oddrel)
47 48
         oddrel.delete()
48 49
 
49 50
     def test_q_object_or(self):
@@ -61,12 +62,12 @@ def test_q_object_or(self):
61 62
         """
62 63
         note_contact = Contact.objects.create()
63 64
         org_contact = Contact.objects.create()
64  
-        note = Note.objects.create(note='note', content_object=note_contact)
  65
+        Note.objects.create(note='note', content_object=note_contact)
65 66
         org = Organization.objects.create(name='org name')
66 67
         org.contacts.add(org_contact)
67 68
         # search with a non-matching note and a matching org name
68 69
         qs = Contact.objects.filter(Q(notes__note__icontains=r'other note') |
69  
-                            Q(organizations__name__icontains=r'org name'))
  70
+                                    Q(organizations__name__icontains=r'org name'))
70 71
         self.assertTrue(org_contact in qs)
71 72
         # search again, with the same query parameters, in reverse order
72 73
         qs = Contact.objects.filter(
@@ -90,8 +91,8 @@ def test_generic_relation_ordering(self):
90 91
         p1 = Place.objects.create(name="South Park")
91 92
         p2 = Place.objects.create(name="The City")
92 93
         c = Company.objects.create(name="Chubby's Intl.")
93  
-        l1 = Link.objects.create(content_object=p1)
94  
-        l2 = Link.objects.create(content_object=c)
  94
+        Link.objects.create(content_object=p1)
  95
+        Link.objects.create(content_object=c)
95 96
 
96 97
         places = list(Place.objects.order_by('links__id'))
97 98
         def count_places(place):
@@ -114,8 +115,10 @@ def test_target_model_len_zero(self):
114 115
         try:
115 116
             note = Note(note='Deserve a bonus', content_object=team1)
116 117
         except Exception as e:
117  
-            if issubclass(type(e), Exception) and str(e) == 'Impossible arguments to GFK.get_content_type!':
118  
-                self.fail("Saving model with GenericForeignKey to model instance whose __len__ method returns 0 shouldn't fail.")
  118
+            if (issubclass(type(e), Exception) and
  119
+                    str(e) == 'Impossible arguments to GFK.get_content_type!'):
  120
+                self.fail("Saving model with GenericForeignKey to model instance whose "
  121
+                          "__len__ method returns 0 shouldn't fail.")
119 122
             raise e
120 123
         note.save()
121 124
 

0 notes on commit 8c5b805

Please sign in to comment.
Something went wrong with that request. Please try again.