mirror of
https://github.com/django/django.git
synced 2025-01-03 06:55:47 +00:00
Fix all violators of E231
This commit is contained in:
parent
f2d8027c9a
commit
9d740eb8b1
@ -4,7 +4,7 @@ install-script = scripts/rpm-install.sh
|
||||
|
||||
[flake8]
|
||||
exclude=./django/utils/dictconfig.py,./django/contrib/comments/*,./django/utils/unittest.py,./tests/comment_tests/*,./django/test/_doctest.py,./django/utils/six.py
|
||||
ignore=E124,E125,E127,E128,E226,E241,E251,E302,E501,E203,E231,E261,F401,F403,W601
|
||||
ignore=E124,E125,E127,E128,E226,E241,E251,E302,E501,E203,E261,F401,F403,W601
|
||||
|
||||
[metadata]
|
||||
license-file = LICENSE
|
||||
|
@ -80,7 +80,7 @@ class FileUploadTests(TestCase):
|
||||
'Content-Disposition: form-data; name="file"; filename="test.txt"',
|
||||
'Content-Type: application/octet-stream',
|
||||
'Content-Transfer-Encoding: base64',
|
||||
'',]))
|
||||
'']))
|
||||
payload.write(b"\r\n" + base64.b64encode(force_bytes(content)) + b"\r\n")
|
||||
payload.write('--' + client.BOUNDARY + '--\r\n')
|
||||
r = {
|
||||
|
@ -15,7 +15,6 @@ from django.forms import (
|
||||
Textarea, TextInput, TimeInput,
|
||||
)
|
||||
from django.forms.widgets import RadioFieldRenderer
|
||||
from django.utils import formats
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils import six
|
||||
from django.utils.translation import activate, deactivate, override
|
||||
|
@ -113,7 +113,7 @@ class SpecializedAuthorCreate(generic.CreateView):
|
||||
context_object_name = 'thingy'
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse('author_detail', args=[self.object.id,])
|
||||
return reverse('author_detail', args=[self.object.id])
|
||||
|
||||
|
||||
class AuthorCreateRestricted(AuthorCreate):
|
||||
@ -151,7 +151,7 @@ class SpecializedAuthorUpdate(generic.UpdateView):
|
||||
context_object_name = 'thingy'
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse('author_detail', args=[self.object.id,])
|
||||
return reverse('author_detail', args=[self.object.id])
|
||||
|
||||
|
||||
class NaiveAuthorDelete(generic.DeleteView):
|
||||
|
@ -439,6 +439,6 @@ class ManyToOneTests(TestCase):
|
||||
Article.objects.values_list,
|
||||
'reporter__notafield')
|
||||
self.assertRaisesMessage(FieldError,
|
||||
expected_message % ', '.join(['EXTRA',] + Article._meta.get_all_field_names()),
|
||||
expected_message % ', '.join(['EXTRA'] + Article._meta.get_all_field_names()),
|
||||
Article.objects.extra(select={'EXTRA': 'EXTRA_SELECT'}).values_list,
|
||||
'notafield')
|
||||
|
@ -654,7 +654,7 @@ class ValidationTests(unittest.TestCase):
|
||||
|
||||
class ValidationTestModelAdmin(ModelAdmin):
|
||||
fieldsets = (("General", {"fields": ("name",)}),)
|
||||
fields = ["name",]
|
||||
fields = ["name"]
|
||||
|
||||
six.assertRaisesRegex(self,
|
||||
ImproperlyConfigured,
|
||||
|
@ -1135,11 +1135,11 @@ class TemplateTests(TransRealMixin, TestCase):
|
||||
|
||||
# Test a date+hour like construct, where the hour of the last day
|
||||
# is the same but the date had changed, so print the hour anyway.
|
||||
'ifchanged-param04': ('{% for d in days %}{% ifchanged %}{{ d.day }}{% endifchanged %}{% for h in d.hours %}{% ifchanged d h %}{{ h }}{% endifchanged %}{% endfor %}{% endfor %}', {'days':[{'day':1, 'hours':[1,2,3]},{'day':2, 'hours':[3]},]}, '112323'),
|
||||
'ifchanged-param04': ('{% for d in days %}{% ifchanged %}{{ d.day }}{% endifchanged %}{% for h in d.hours %}{% ifchanged d h %}{{ h }}{% endifchanged %}{% endfor %}{% endfor %}', {'days': [{'day': 1, 'hours': [1, 2, 3]}, {'day': 2, 'hours': [3]}]}, '112323'),
|
||||
|
||||
# Logically the same as above, just written with explicit
|
||||
# ifchanged for the day.
|
||||
'ifchanged-param05': ('{% for d in days %}{% ifchanged d.day %}{{ d.day }}{% endifchanged %}{% for h in d.hours %}{% ifchanged d.day h %}{{ h }}{% endifchanged %}{% endfor %}{% endfor %}', {'days':[{'day':1, 'hours':[1,2,3]},{'day':2, 'hours':[3]},]}, '112323'),
|
||||
'ifchanged-param05': ('{% for d in days %}{% ifchanged d.day %}{{ d.day }}{% endifchanged %}{% for h in d.hours %}{% ifchanged d.day h %}{{ h }}{% endifchanged %}{% endfor %}{% endfor %}', {'days': [{'day': 1, 'hours': [1, 2, 3]}, {'day': 2, 'hours': [3]}]}, '112323'),
|
||||
|
||||
# Test the else clause of ifchanged.
|
||||
'ifchanged-else01': ('{% for id in ids %}{{ id }}{% ifchanged id %}-first{% else %}-other{% endifchanged %},{% endfor %}', {'ids': [1, 1, 2, 2, 2, 3]}, '1-first,1-other,2-first,2-other,2-other,3-first,'),
|
||||
|
@ -119,9 +119,9 @@ class GenericIPAddressFieldTests(ValidationTestCase):
|
||||
|
||||
def test_invalid_generic_ip_raises_error(self):
|
||||
giptm = GenericIPAddressTestModel(generic_ip="294.4.2.1")
|
||||
self.assertFailsValidation(giptm.full_clean, ['generic_ip',])
|
||||
self.assertFailsValidation(giptm.full_clean, ['generic_ip'])
|
||||
giptm = GenericIPAddressTestModel(generic_ip="1:2")
|
||||
self.assertFailsValidation(giptm.full_clean, ['generic_ip',])
|
||||
self.assertFailsValidation(giptm.full_clean, ['generic_ip'])
|
||||
|
||||
def test_correct_v4_ip_passes(self):
|
||||
giptm = GenericIPAddressTestModel(v4_ip="1.2.3.4")
|
||||
@ -161,7 +161,7 @@ class GenericIPAddressFieldTests(ValidationTestCase):
|
||||
giptm = GenericIPAddrUnpackUniqueTest(generic_v4unpack_ip="::ffff:18.52.18.52")
|
||||
giptm.save()
|
||||
giptm = GenericIPAddrUnpackUniqueTest(generic_v4unpack_ip="18.52.18.52")
|
||||
self.assertFailsValidation(giptm.full_clean, ['generic_v4unpack_ip',])
|
||||
self.assertFailsValidation(giptm.full_clean, ['generic_v4unpack_ip'])
|
||||
|
||||
def test_empty_generic_ip_passes(self):
|
||||
giptm = GenericIPAddressTestModel(generic_ip="")
|
||||
|
@ -304,7 +304,7 @@ class ExceptionReportTestMixin(object):
|
||||
breakfast_data = {'sausage-key': 'sausage-value',
|
||||
'baked-beans-key': 'baked-beans-value',
|
||||
'hash-brown-key': 'hash-brown-value',
|
||||
'bacon-key': 'bacon-value',}
|
||||
'bacon-key': 'bacon-value'}
|
||||
|
||||
def verify_unsafe_response(self, view, check_for_vars=True,
|
||||
check_for_POST_params=True):
|
||||
|
Loading…
Reference in New Issue
Block a user