diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2013-10-26 12:15:03 -0700 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2013-10-26 12:15:03 -0700 |
commit | 9d740eb8b15de31f1c5520659df683d90342bb44 (patch) | |
tree | 62b6ff49e5a60467828f9b04d46b6ebeac86c333 /tests/m2m_through | |
parent | f2d8027c9aea93750fc4213d9e733c8575e89502 (diff) | |
download | django-9d740eb8b15de31f1c5520659df683d90342bb44.tar.gz |
Fix all violators of E231
Diffstat (limited to 'tests/m2m_through')
-rw-r--r-- | tests/m2m_through/tests.py | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/tests/m2m_through/tests.py b/tests/m2m_through/tests.py index 8eab7f7e7c..1e1b32f9eb 100644 --- a/tests/m2m_through/tests.py +++ b/tests/m2m_through/tests.py @@ -101,7 +101,7 @@ class M2mThroughTests(TestCase): m2.save() # Verifying that those instances were re-saved successfully. self.assertQuerysetEqual( - self.rock.members.all(),[ + self.rock.members.all(), [ 'Jane', 'Jim' ], @@ -142,7 +142,7 @@ class M2mThroughTests(TestCase): m2.save() # Verifying that those instances were re-saved successfully. self.assertQuerysetEqual( - self.jim.group_set.all(),[ + self.jim.group_set.all(), [ 'Rock', 'Roll' ], @@ -166,7 +166,7 @@ class M2mThroughTests(TestCase): # If we get the number of people in Rock, it should be both Bob and Jim. self.assertQuerysetEqual( - self.rock.custom_members.all(),[ + self.rock.custom_members.all(), [ 'Bob', 'Jim' ], @@ -174,14 +174,14 @@ class M2mThroughTests(TestCase): ) # Bob should only be in one custom group. self.assertQuerysetEqual( - self.bob.custom.all(),[ + self.bob.custom.all(), [ 'Rock' ], attrgetter("name") ) # Let's make sure our new descriptors don't conflict with the FK related_name. self.assertQuerysetEqual( - self.bob.custom_person_related_name.all(),[ + self.bob.custom_person_related_name.all(), [ '<CustomMembership: Bob is a member of Rock>' ] ) @@ -199,7 +199,7 @@ class M2mThroughTests(TestCase): # Tony should now show that Chris is his friend. self.assertQuerysetEqual( - tony.friends.all(),[ + tony.friends.all(), [ 'Chris' ], attrgetter("name") @@ -214,7 +214,7 @@ class M2mThroughTests(TestCase): # Having added Chris as a friend, let's make sure that his friend set reflects # that addition. self.assertQuerysetEqual( - chris.friends.all(),[ + chris.friends.all(), [ 'Tony' ], attrgetter("name") @@ -229,7 +229,7 @@ class M2mThroughTests(TestCase): ) # Since this isn't a symmetrical relation, Tony's friend link still exists. self.assertQuerysetEqual( - tony.friends.all(),[ + tony.friends.all(), [ 'Chris' ], attrgetter("name") @@ -253,7 +253,7 @@ class M2mThroughTests(TestCase): # We can query for the related model by using its attribute name (members, in # this case). self.assertQuerysetEqual( - Group.objects.filter(members__name='Bob'),[ + Group.objects.filter(members__name='Bob'), [ 'Roll' ], attrgetter("name") @@ -262,7 +262,7 @@ class M2mThroughTests(TestCase): # To query through the intermediary model, we specify its model name. # In this case, membership. self.assertQuerysetEqual( - Group.objects.filter(membership__invite_reason="She was just awesome."),[ + Group.objects.filter(membership__invite_reason="She was just awesome."), [ 'Rock' ], attrgetter("name") @@ -271,7 +271,7 @@ class M2mThroughTests(TestCase): # If we want to query in the reverse direction by the related model, use its # model name (group, in this case). self.assertQuerysetEqual( - Person.objects.filter(group__name="Rock"),[ + Person.objects.filter(group__name="Rock"), [ 'Jane', 'Jim' ], @@ -282,7 +282,7 @@ class M2mThroughTests(TestCase): CustomMembership.objects.create(person=self.jim, group=self.rock) # If the m2m field has specified a related_name, using that will work. self.assertQuerysetEqual( - Person.objects.filter(custom__name="Rock"),[ + Person.objects.filter(custom__name="Rock"), [ 'Bob', 'Jim' ], @@ -292,7 +292,7 @@ class M2mThroughTests(TestCase): # To query through the intermediary model in the reverse direction, we again # specify its model name (membership, in this case). self.assertQuerysetEqual( - Person.objects.filter(membership__invite_reason="She was just awesome."),[ + Person.objects.filter(membership__invite_reason="She was just awesome."), [ 'Jane' ], attrgetter("name") @@ -300,7 +300,7 @@ class M2mThroughTests(TestCase): # Let's see all of the groups that Jane joined after 1 Jan 2005: self.assertQuerysetEqual( - Group.objects.filter(membership__date_joined__gt=datetime(2005, 1, 1), membership__person=self.jane),[ + Group.objects.filter(membership__date_joined__gt=datetime(2005, 1, 1), membership__person=self.jane), [ 'Rock' ], attrgetter("name") @@ -309,7 +309,7 @@ class M2mThroughTests(TestCase): # Queries also work in the reverse direction: Now let's see all of the people # that have joined Rock since 1 Jan 2005: self.assertQuerysetEqual( - Person.objects.filter(membership__date_joined__gt=datetime(2005, 1, 1), membership__group=self.rock),[ + Person.objects.filter(membership__date_joined__gt=datetime(2005, 1, 1), membership__group=self.rock), [ 'Jane', 'Jim' ], @@ -320,7 +320,7 @@ class M2mThroughTests(TestCase): # querysets. To demonstrate this, we query for all people who have joined a # group after 2004: self.assertQuerysetEqual( - Person.objects.filter(membership__date_joined__gt=datetime(2004, 1, 1)),[ + Person.objects.filter(membership__date_joined__gt=datetime(2004, 1, 1)), [ 'Jane', 'Jim', 'Jim' @@ -335,7 +335,7 @@ class M2mThroughTests(TestCase): ) # QuerySet's distinct() method can correct this problem. self.assertQuerysetEqual( - Person.objects.filter(membership__date_joined__gt=datetime(2004, 1, 1)).distinct(),[ + Person.objects.filter(membership__date_joined__gt=datetime(2004, 1, 1)).distinct(), [ 'Jane', 'Jim' ], |