Skip to content

Commit

Permalink
Fixed all E251 violations
Browse files Browse the repository at this point in the history
  • Loading branch information
alex committed Nov 3, 2013
1 parent c347f78 commit f67e18f
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Expand Up @@ -4,7 +4,7 @@ install-script = scripts/rpm-install.sh


[flake8] [flake8]
exclude=./django/utils/dictconfig.py,./django/contrib/comments/*,./django/utils/unittest.py,./tests/comment_tests/*,./django/test/_doctest.py,./django/utils/six.py,./django/conf/app_template/* exclude=./django/utils/dictconfig.py,./django/contrib/comments/*,./django/utils/unittest.py,./tests/comment_tests/*,./django/test/_doctest.py,./django/utils/six.py,./django/conf/app_template/*
ignore=E124,E125,E127,E128,E251,E501,W601 ignore=E124,E125,E127,E128,E501,W601


[metadata] [metadata]
license-file = LICENSE license-file = LICENSE
Expand Down
2 changes: 1 addition & 1 deletion tests/datatypes/tests.py
Expand Up @@ -61,7 +61,7 @@ def test_year_boundaries(self):
Donut.objects.filter(baked_date__year=2006)[0].name) Donut.objects.filter(baked_date__year=2006)[0].name)


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)) consumed_at=datetime.datetime(year=2007, month=4, day=20, hour=16, minute=19, second=59))


self.assertEqual(['Apple Fritter', 'Date Test 2007'], self.assertEqual(['Apple Fritter', 'Date Test 2007'],
list(Donut.objects.filter(consumed_at__year=2007).order_by('name').values_list('name', flat=True))) list(Donut.objects.filter(consumed_at__year=2007).order_by('name').values_list('name', flat=True)))
Expand Down
2 changes: 1 addition & 1 deletion tests/force_insert_update/models.py
Expand Up @@ -6,7 +6,7 @@




class Counter(models.Model): class Counter(models.Model):
name = models.CharField(max_length = 10) name = models.CharField(max_length=10)
value = models.IntegerField() value = models.IntegerField()




Expand Down
2 changes: 1 addition & 1 deletion tests/forms_tests/tests/test_fields.py
Expand Up @@ -691,7 +691,7 @@ def test_filefield_1(self):
self.assertEqual(SimpleUploadedFile, type(f.clean(SimpleUploadedFile('name', b'Some File Content'), 'files/test4.pdf'))) self.assertEqual(SimpleUploadedFile, type(f.clean(SimpleUploadedFile('name', b'Some File Content'), 'files/test4.pdf')))


def test_filefield_2(self): def test_filefield_2(self):
f = FileField(max_length = 5) f = FileField(max_length=5)
self.assertRaisesMessage(ValidationError, "'Ensure this filename has at most 5 characters (it has 18).'", f.clean, SimpleUploadedFile('test_maxlength.txt', b'hello world')) self.assertRaisesMessage(ValidationError, "'Ensure this filename has at most 5 characters (it has 18).'", f.clean, SimpleUploadedFile('test_maxlength.txt', b'hello world'))
self.assertEqual('files/test1.pdf', f.clean('', 'files/test1.pdf')) self.assertEqual('files/test1.pdf', f.clean('', 'files/test1.pdf'))
self.assertEqual('files/test2.pdf', f.clean(None, 'files/test2.pdf')) self.assertEqual('files/test2.pdf', f.clean(None, 'files/test2.pdf'))
Expand Down
16 changes: 8 additions & 8 deletions tests/forms_tests/tests/test_media.py
Expand Up @@ -133,7 +133,7 @@ def test_media_property(self):
# Widget media can be defined as a property # Widget media can be defined as a property
class MyWidget4(TextInput): class MyWidget4(TextInput):
def _media(self): def _media(self):
return Media(css={'all': ('/some/path',)}, js = ('/some/js',)) return Media(css={'all': ('/some/path',)}, js=('/some/js',))
media = property(_media) media = property(_media)


w4 = MyWidget4() w4 = MyWidget4()
Expand All @@ -143,7 +143,7 @@ def _media(self):
# Media properties can reference the media of their parents # Media properties can reference the media of their parents
class MyWidget5(MyWidget4): class MyWidget5(MyWidget4):
def _media(self): def _media(self):
return super(MyWidget5, self).media + Media(css={'all': ('/other/path',)}, js = ('/other/js',)) return super(MyWidget5, self).media + Media(css={'all': ('/other/path',)}, js=('/other/js',))
media = property(_media) media = property(_media)


w5 = MyWidget5() w5 = MyWidget5()
Expand All @@ -164,7 +164,7 @@ class Media:


class MyWidget6(MyWidget1): class MyWidget6(MyWidget1):
def _media(self): def _media(self):
return super(MyWidget6, self).media + Media(css={'all': ('/other/path',)}, js = ('/other/js',)) return super(MyWidget6, self).media + Media(css={'all': ('/other/path',)}, js=('/other/js',))
media = property(_media) media = property(_media)


w6 = MyWidget6() w6 = MyWidget6()
Expand Down Expand Up @@ -228,7 +228,7 @@ class Media:


class MyWidget4(TextInput): class MyWidget4(TextInput):
def _media(self): def _media(self):
return Media(css={'all': ('/some/path',)}, js = ('/some/js',)) return Media(css={'all': ('/some/path',)}, js=('/some/js',))
media = property(_media) media = property(_media)


class MyWidget9(MyWidget4): class MyWidget9(MyWidget4):
Expand Down Expand Up @@ -585,7 +585,7 @@ def test_media_property(self):
# Widget media can be defined as a property # Widget media can be defined as a property
class MyWidget4(TextInput): class MyWidget4(TextInput):
def _media(self): def _media(self):
return Media(css={'all': ('/some/path',)}, js = ('/some/js',)) return Media(css={'all': ('/some/path',)}, js=('/some/js',))
media = property(_media) media = property(_media)


w4 = MyWidget4() w4 = MyWidget4()
Expand All @@ -595,7 +595,7 @@ def _media(self):
# Media properties can reference the media of their parents # Media properties can reference the media of their parents
class MyWidget5(MyWidget4): class MyWidget5(MyWidget4):
def _media(self): def _media(self):
return super(MyWidget5, self).media + Media(css={'all': ('/other/path',)}, js = ('/other/js',)) return super(MyWidget5, self).media + Media(css={'all': ('/other/path',)}, js=('/other/js',))
media = property(_media) media = property(_media)


w5 = MyWidget5() w5 = MyWidget5()
Expand All @@ -616,7 +616,7 @@ class Media:


class MyWidget6(MyWidget1): class MyWidget6(MyWidget1):
def _media(self): def _media(self):
return super(MyWidget6, self).media + Media(css={'all': ('/other/path',)}, js = ('/other/js',)) return super(MyWidget6, self).media + Media(css={'all': ('/other/path',)}, js=('/other/js',))
media = property(_media) media = property(_media)


w6 = MyWidget6() w6 = MyWidget6()
Expand Down Expand Up @@ -680,7 +680,7 @@ class Media:


class MyWidget4(TextInput): class MyWidget4(TextInput):
def _media(self): def _media(self):
return Media(css={'all': ('/some/path',)}, js = ('/some/js',)) return Media(css={'all': ('/some/path',)}, js=('/some/js',))
media = property(_media) media = property(_media)


class MyWidget9(MyWidget4): class MyWidget9(MyWidget4):
Expand Down
8 changes: 4 additions & 4 deletions tests/forms_tests/tests/test_validators.py
Expand Up @@ -9,15 +9,15 @@


class UserForm(forms.Form): class UserForm(forms.Form):
full_name = forms.CharField( full_name = forms.CharField(
max_length = 50, max_length=50,
validators = [ validators=[
validators.validate_integer, validators.validate_integer,
validators.validate_email, validators.validate_email,
] ]
) )
string = forms.CharField( string = forms.CharField(
max_length = 50, max_length=50,
validators = [ validators=[
validators.RegexValidator( validators.RegexValidator(
regex='^[a-zA-Z]*$', regex='^[a-zA-Z]*$',
message="Letters only.", message="Letters only.",
Expand Down
2 changes: 1 addition & 1 deletion tests/initial_sql_regress/models.py
Expand Up @@ -6,4 +6,4 @@




class Simple(models.Model): class Simple(models.Model):
name = models.CharField(max_length = 50) name = models.CharField(max_length=50)
2 changes: 1 addition & 1 deletion tests/migrations/test_operations.py
Expand Up @@ -303,7 +303,7 @@ def test_run_sql(self):
operation = migrations.RunSQL( operation = migrations.RunSQL(
"CREATE TABLE i_love_ponies (id int, special_thing int)", "CREATE TABLE i_love_ponies (id int, special_thing int)",
"DROP TABLE i_love_ponies", "DROP TABLE i_love_ponies",
state_operations = [migrations.CreateModel("SomethingElse", [("id", models.AutoField(primary_key=True))])], state_operations=[migrations.CreateModel("SomethingElse", [("id", models.AutoField(primary_key=True))])],
) )
# Test the state alteration # Test the state alteration
new_state = project_state.clone() new_state = project_state.clone()
Expand Down
2 changes: 1 addition & 1 deletion tests/migrations/test_optimizer.py
Expand Up @@ -64,7 +64,7 @@ def test_single(self):
self.assertOptimizesTo( self.assertOptimizesTo(
[migrations.DeleteModel("Foo")], [migrations.DeleteModel("Foo")],
[migrations.DeleteModel("Foo")], [migrations.DeleteModel("Foo")],
exact = 1, exact=1,
) )


def test_create_delete_model(self): def test_create_delete_model(self):
Expand Down
4 changes: 2 additions & 2 deletions tests/null_fk/tests.py
Expand Up @@ -31,7 +31,7 @@ def test_null_fk(self):
(c1.id, 'My first comment', '<Post: First Post>'), (c1.id, 'My first comment', '<Post: First Post>'),
(c2.id, 'My second comment', 'None') (c2.id, 'My second comment', 'None')
], ],
transform = lambda c: (c.id, c.comment_text, repr(c.post)) transform=lambda c: (c.id, c.comment_text, repr(c.post))
) )


# Regression test for #7530, #7716. # Regression test for #7530, #7716.
Expand All @@ -43,7 +43,7 @@ def test_null_fk(self):
(c1.id, 'My first comment', '<Post: First Post>'), (c1.id, 'My first comment', '<Post: First Post>'),
(c2.id, 'My second comment', 'None') (c2.id, 'My second comment', 'None')
], ],
transform = lambda c: (c.id, c.comment_text, repr(c.post)) transform=lambda c: (c.id, c.comment_text, repr(c.post))
) )


def test_combine_isnull(self): def test_combine_isnull(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/properties/tests.py
Expand Up @@ -19,6 +19,6 @@ def test_setter(self):
self.assertRaises(AttributeError, setattr, self.a, 'full_name', 'Paul McCartney') self.assertRaises(AttributeError, setattr, self.a, 'full_name', 'Paul McCartney')


# But "full_name_2" has, and it can be used to initialise the class. # But "full_name_2" has, and it can be used to initialise the class.
a2 = Person(full_name_2 = 'Paul McCartney') a2 = Person(full_name_2='Paul McCartney')
a2.save() a2.save()
self.assertEqual(a2.first_name, 'Paul') self.assertEqual(a2.first_name, 'Paul')
24 changes: 12 additions & 12 deletions tests/schema/tests.py
Expand Up @@ -106,9 +106,9 @@ def test_fk(self):
# Make sure the FK constraint is present # Make sure the FK constraint is present
with self.assertRaises(IntegrityError): with self.assertRaises(IntegrityError):
Book.objects.create( Book.objects.create(
author_id = 1, author_id=1,
title = "Much Ado About Foreign Keys", title="Much Ado About Foreign Keys",
pub_date = datetime.datetime.now(), pub_date=datetime.datetime.now(),
) )
# Repoint the FK constraint # Repoint the FK constraint
new_field = ForeignKey(Tag) new_field = ForeignKey(Tag)
Expand Down Expand Up @@ -211,7 +211,7 @@ def test_rename(self):
Author, Author,
Author._meta.get_field_by_name("name")[0], Author._meta.get_field_by_name("name")[0],
new_field, new_field,
strict = True, strict=True,
) )
# Ensure the field is right afterwards # Ensure the field is right afterwards
columns = self.column_classes(Author) columns = self.column_classes(Author)
Expand Down Expand Up @@ -337,7 +337,7 @@ def test_check_constraints(self):
Author, Author,
Author._meta.get_field_by_name("height")[0], Author._meta.get_field_by_name("height")[0],
new_field, new_field,
strict = True, strict=True,
) )
constraints = connection.introspection.get_constraints(connection.cursor(), Author._meta.db_table) constraints = connection.introspection.get_constraints(connection.cursor(), Author._meta.db_table)
for name, details in constraints.items(): for name, details in constraints.items():
Expand All @@ -349,7 +349,7 @@ def test_check_constraints(self):
Author, Author,
new_field, new_field,
Author._meta.get_field_by_name("height")[0], Author._meta.get_field_by_name("height")[0],
strict = True, strict=True,
) )
constraints = connection.introspection.get_constraints(connection.cursor(), Author._meta.db_table) constraints = connection.introspection.get_constraints(connection.cursor(), Author._meta.db_table)
for name, details in constraints.items(): for name, details in constraints.items():
Expand Down Expand Up @@ -377,7 +377,7 @@ def test_unique(self):
Tag, Tag,
Tag._meta.get_field_by_name("slug")[0], Tag._meta.get_field_by_name("slug")[0],
new_field, new_field,
strict = True, strict=True,
) )
# Ensure the field is no longer unique # Ensure the field is no longer unique
Tag.objects.create(title="foo", slug="foo") Tag.objects.create(title="foo", slug="foo")
Expand All @@ -391,7 +391,7 @@ def test_unique(self):
Tag, Tag,
new_field, new_field,
new_new_field, new_new_field,
strict = True, strict=True,
) )
# Ensure the field is unique again # Ensure the field is unique again
Tag.objects.create(title="foo", slug="foo") Tag.objects.create(title="foo", slug="foo")
Expand All @@ -405,7 +405,7 @@ def test_unique(self):
Tag, Tag,
Tag._meta.get_field_by_name("slug")[0], Tag._meta.get_field_by_name("slug")[0],
TagUniqueRename._meta.get_field_by_name("slug2")[0], TagUniqueRename._meta.get_field_by_name("slug2")[0],
strict = True, strict=True,
) )
# Ensure the field is still unique # Ensure the field is still unique
TagUniqueRename.objects.create(title="foo", slug2="foo") TagUniqueRename.objects.create(title="foo", slug2="foo")
Expand Down Expand Up @@ -572,7 +572,7 @@ def test_indexes(self):
Book, Book,
Book._meta.get_field_by_name("title")[0], Book._meta.get_field_by_name("title")[0],
new_field, new_field,
strict = True, strict=True,
) )
# Ensure the table is there and has no index # Ensure the table is there and has no index
self.assertNotIn( self.assertNotIn(
Expand All @@ -585,7 +585,7 @@ def test_indexes(self):
Book, Book,
new_field, new_field,
Book._meta.get_field_by_name("title")[0], Book._meta.get_field_by_name("title")[0],
strict = True, strict=True,
) )
# Ensure the table is there and has the index again # Ensure the table is there and has the index again
self.assertIn( self.assertIn(
Expand All @@ -610,7 +610,7 @@ def test_indexes(self):
BookWithSlug, BookWithSlug,
BookWithSlug._meta.get_field_by_name("slug")[0], BookWithSlug._meta.get_field_by_name("slug")[0],
new_field2, new_field2,
strict = True, strict=True,
) )
self.assertNotIn( self.assertNotIn(
"slug", "slug",
Expand Down
4 changes: 2 additions & 2 deletions tests/select_related_regress/tests.py
Expand Up @@ -58,8 +58,8 @@ def test_regression_8106(self):
usp = Person.objects.create(user=us) usp = Person.objects.create(user=us)
uo = TUser.objects.create(name="org") uo = TUser.objects.create(name="org")
uop = Person.objects.create(user=uo) uop = Person.objects.create(user=uo)
s = Student.objects.create(person = usp) s = Student.objects.create(person=usp)
o = Organizer.objects.create(person = uop) o = Organizer.objects.create(person=uop)
c = Class.objects.create(org=o) c = Class.objects.create(org=o)
Enrollment.objects.create(std=s, cls=c) Enrollment.objects.create(std=s, cls=c)


Expand Down
2 changes: 1 addition & 1 deletion tests/signed_cookies_tests/tests.py
Expand Up @@ -59,6 +59,6 @@ def test_max_age_argument(self):
self.assertEqual(request.get_signed_cookie('c', max_age=12), value) self.assertEqual(request.get_signed_cookie('c', max_age=12), value)
self.assertEqual(request.get_signed_cookie('c', max_age=11), value) self.assertEqual(request.get_signed_cookie('c', max_age=11), value)
self.assertRaises(signing.SignatureExpired, self.assertRaises(signing.SignatureExpired,
request.get_signed_cookie, 'c', max_age = 10) request.get_signed_cookie, 'c', max_age=10)
finally: finally:
time.time = _time time.time = _time

0 comments on commit f67e18f

Please sign in to comment.