Fixed #21285 -- Fixed E121,E122 pep8 warnings
This commit is contained in:
parent
d97bec5ee3
commit
dfb4cb9970
|
@ -198,7 +198,7 @@ TEMPLATE_DIRS = ()
|
|||
TEMPLATE_LOADERS = (
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader',
|
||||
# 'django.template.loaders.eggs.Loader',
|
||||
# 'django.template.loaders.eggs.Loader',
|
||||
)
|
||||
|
||||
# List of processors used by RequestContext to populate the context.
|
||||
|
@ -211,7 +211,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
|
|||
'django.core.context_processors.media',
|
||||
'django.core.context_processors.static',
|
||||
'django.core.context_processors.tz',
|
||||
# 'django.core.context_processors.request',
|
||||
# 'django.core.context_processors.request',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
)
|
||||
|
||||
|
@ -456,8 +456,8 @@ MIDDLEWARE_CLASSES = (
|
|||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
# 'django.middleware.http.ConditionalGetMiddleware',
|
||||
# 'django.middleware.gzip.GZipMiddleware',
|
||||
# 'django.middleware.http.ConditionalGetMiddleware',
|
||||
# 'django.middleware.gzip.GZipMiddleware',
|
||||
)
|
||||
|
||||
############
|
||||
|
@ -607,7 +607,7 @@ STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'
|
|||
STATICFILES_FINDERS = (
|
||||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
|
||||
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
|
||||
)
|
||||
|
||||
##############
|
||||
|
|
|
@ -166,9 +166,8 @@ class RelatedFieldListFilter(FieldListFilter):
|
|||
rel_name = other_model._meta.pk.name
|
||||
self.lookup_kwarg = '%s__%s__exact' % (field_path, rel_name)
|
||||
self.lookup_kwarg_isnull = '%s__isnull' % field_path
|
||||
self.lookup_val = request.GET.get(self.lookup_kwarg, None)
|
||||
self.lookup_val_isnull = request.GET.get(
|
||||
self.lookup_kwarg_isnull, None)
|
||||
self.lookup_val = request.GET.get(self.lookup_kwarg)
|
||||
self.lookup_val_isnull = request.GET.get(self.lookup_kwarg_isnull)
|
||||
self.lookup_choices = field.get_choices(include_blank=False)
|
||||
super(RelatedFieldListFilter, self).__init__(
|
||||
field, request, params, model, model_admin, field_path)
|
||||
|
|
|
@ -1198,9 +1198,9 @@ class ModelAdmin(BaseModelAdmin):
|
|||
|
||||
self.message_user(request, _(
|
||||
'The %(name)s "%(obj)s" was deleted successfully.') % {
|
||||
'name': force_text(opts.verbose_name),
|
||||
'obj': force_text(obj_display)},
|
||||
messages.SUCCESS)
|
||||
'name': force_text(opts.verbose_name),
|
||||
'obj': force_text(obj_display)
|
||||
}, messages.SUCCESS)
|
||||
|
||||
if self.has_change_permission(request, None):
|
||||
post_url = reverse('admin:%s_%s_changelist' %
|
||||
|
@ -1221,10 +1221,10 @@ class ModelAdmin(BaseModelAdmin):
|
|||
|
||||
return TemplateResponse(request,
|
||||
self.delete_confirmation_template or [
|
||||
"admin/{}/{}/delete_confirmation.html".format(app_label, opts.model_name),
|
||||
"admin/{}/delete_confirmation.html".format(app_label),
|
||||
"admin/delete_confirmation.html"
|
||||
], context, current_app=self.admin_site.name)
|
||||
"admin/{}/{}/delete_confirmation.html".format(app_label, opts.model_name),
|
||||
"admin/{}/delete_confirmation.html".format(app_label),
|
||||
"admin/delete_confirmation.html"
|
||||
], context, current_app=self.admin_site.name)
|
||||
|
||||
@csrf_protect_m
|
||||
@transaction.atomic
|
||||
|
|
|
@ -49,9 +49,9 @@ def _is_changelist_popup(request):
|
|||
IS_LEGACY_POPUP_VAR = 'pop'
|
||||
if IS_LEGACY_POPUP_VAR in request.GET:
|
||||
warnings.warn(
|
||||
"The `%s` GET parameter has been renamed to `%s`." %
|
||||
(IS_LEGACY_POPUP_VAR, IS_POPUP_VAR),
|
||||
DeprecationWarning, 2)
|
||||
"The `%s` GET parameter has been renamed to `%s`." %
|
||||
(IS_LEGACY_POPUP_VAR, IS_POPUP_VAR),
|
||||
DeprecationWarning, 2)
|
||||
return True
|
||||
|
||||
return False
|
||||
|
|
|
@ -106,7 +106,7 @@ class AuthenticationFormTest(TestCase):
|
|||
self.assertFalse(form.is_valid())
|
||||
self.assertEqual(form.non_field_errors(),
|
||||
[force_text(form.error_messages['invalid_login'] % {
|
||||
'username': User._meta.get_field('username').verbose_name
|
||||
'username': User._meta.get_field('username').verbose_name
|
||||
})])
|
||||
|
||||
def test_inactive_user(self):
|
||||
|
|
|
@ -217,7 +217,7 @@ class PermissionTestCase(TestCase):
|
|||
"""
|
||||
# check duplicated default permission
|
||||
models.Permission._meta.permissions = [
|
||||
('change_permission', 'Can edit permission (duplicate)')]
|
||||
('change_permission', 'Can edit permission (duplicate)')]
|
||||
six.assertRaisesRegex(self, CommandError,
|
||||
"The permission codename 'change_permission' clashes with a "
|
||||
"builtin permission for model 'auth.Permission'.",
|
||||
|
|
|
@ -13,10 +13,10 @@ urlpatterns = patterns('',
|
|||
('form2', Page2),
|
||||
('form3', Page3),
|
||||
('form4', Page4)])),
|
||||
url(r'^wiz_other_template/$', CookieContactWizard.as_view(
|
||||
[('form1', Page1),
|
||||
('form2', Page2),
|
||||
('form3', Page3),
|
||||
('form4', Page4)],
|
||||
template_name='other_wizard_form.html')),
|
||||
url(r'^wiz_other_template/$', CookieContactWizard.as_view(
|
||||
[('form1', Page1),
|
||||
('form2', Page2),
|
||||
('form3', Page3),
|
||||
('form4', Page4)],
|
||||
template_name='other_wizard_form.html')),
|
||||
)
|
||||
|
|
|
@ -36,7 +36,7 @@ class OpenLayersWidget(Textarea):
|
|||
except (GEOSException, ValueError) as err:
|
||||
logger.error(
|
||||
"Error creating geometry from value '%s' (%s)" % (
|
||||
value, err)
|
||||
value, err)
|
||||
)
|
||||
value = None
|
||||
|
||||
|
@ -68,7 +68,7 @@ class OpenLayersWidget(Textarea):
|
|||
except OGRException as err:
|
||||
logger.error(
|
||||
"Error transforming geometry from srid '%s' to srid '%s' (%s)" % (
|
||||
value.srid, srid, err)
|
||||
value.srid, srid, err)
|
||||
)
|
||||
wkt = ''
|
||||
else:
|
||||
|
|
|
@ -9,6 +9,6 @@ from django.contrib.gis.db.models.manager import GeoManager
|
|||
|
||||
# The geographic-enabled fields.
|
||||
from django.contrib.gis.db.models.fields import (
|
||||
GeometryField, PointField, LineStringField, PolygonField,
|
||||
MultiPointField, MultiLineStringField, MultiPolygonField,
|
||||
GeometryCollectionField)
|
||||
GeometryField, PointField, LineStringField, PolygonField,
|
||||
MultiPointField, MultiLineStringField, MultiPolygonField,
|
||||
GeometryCollectionField)
|
||||
|
|
|
@ -43,7 +43,7 @@ class BaseGeometryWidget(Widget):
|
|||
except (GEOSException, ValueError) as err:
|
||||
logger.error(
|
||||
"Error creating geometry from value '%s' (%s)" % (
|
||||
value, err)
|
||||
value, err)
|
||||
)
|
||||
return None
|
||||
|
||||
|
@ -63,7 +63,7 @@ class BaseGeometryWidget(Widget):
|
|||
except gdal.OGRException as err:
|
||||
logger.error(
|
||||
"Error transforming geometry from srid '%s' to srid '%s' (%s)" % (
|
||||
value.srid, self.map_srid, err)
|
||||
value.srid, self.map_srid, err)
|
||||
)
|
||||
|
||||
context = self.build_attrs(attrs,
|
||||
|
|
|
@ -34,7 +34,7 @@ class Message(object):
|
|||
|
||||
def __eq__(self, other):
|
||||
return isinstance(other, Message) and self.level == other.level and \
|
||||
self.message == other.message
|
||||
self.message == other.message
|
||||
|
||||
def __str__(self):
|
||||
return force_text(self.message)
|
||||
|
|
|
@ -219,7 +219,7 @@ class BaseTests(object):
|
|||
lambda m:'MessageMiddleware' not in m, settings.MIDDLEWARE_CLASSES),
|
||||
TEMPLATE_CONTEXT_PROCESSORS=filter(
|
||||
lambda p:'context_processors.messages' not in p,
|
||||
settings.TEMPLATE_CONTEXT_PROCESSORS),
|
||||
settings.TEMPLATE_CONTEXT_PROCESSORS),
|
||||
MESSAGE_LEVEL=constants.DEBUG
|
||||
)
|
||||
def test_middleware_disabled(self):
|
||||
|
@ -244,7 +244,7 @@ class BaseTests(object):
|
|||
lambda m:'MessageMiddleware' not in m, settings.MIDDLEWARE_CLASSES),
|
||||
TEMPLATE_CONTEXT_PROCESSORS=filter(
|
||||
lambda p:'context_processors.messages' not in p,
|
||||
settings.TEMPLATE_CONTEXT_PROCESSORS),
|
||||
settings.TEMPLATE_CONTEXT_PROCESSORS),
|
||||
MESSAGE_LEVEL=constants.DEBUG
|
||||
)
|
||||
def test_middleware_disabled_fail_silently(self):
|
||||
|
|
|
@ -251,9 +251,9 @@ def get_validation_errors(outfile, app=None):
|
|||
"than one foreign key to %s, which is "
|
||||
"ambiguous and is not permitted." % (
|
||||
f.rel.through._meta.object_name,
|
||||
from_model._meta.object_name
|
||||
)
|
||||
)
|
||||
from_model._meta.object_name
|
||||
)
|
||||
)
|
||||
else:
|
||||
seen_from = True
|
||||
elif rel_to == to_model:
|
||||
|
|
|
@ -439,9 +439,9 @@ class BaseDatabaseCreation(object):
|
|||
settings_dict['NAME'] = old_database_name
|
||||
backend = load_backend(settings_dict['ENGINE'])
|
||||
new_connection = backend.DatabaseWrapper(
|
||||
settings_dict,
|
||||
alias='__destroy_test_db__',
|
||||
allow_thread_sharing=False)
|
||||
settings_dict,
|
||||
alias='__destroy_test_db__',
|
||||
allow_thread_sharing=False)
|
||||
new_connection.creation._destroy_test_db(test_database_name, verbosity)
|
||||
|
||||
def _destroy_test_db(self, test_database_name, verbosity):
|
||||
|
|
|
@ -566,8 +566,8 @@ class Model(six.with_metaclass(ModelBase)):
|
|||
deferred_fields = [
|
||||
f.attname for f in self._meta.fields
|
||||
if f.attname not in self.__dict__
|
||||
and isinstance(self.__class__.__dict__[f.attname],
|
||||
DeferredAttribute)]
|
||||
and isinstance(self.__class__.__dict__[f.attname],
|
||||
DeferredAttribute)]
|
||||
|
||||
loaded_fields = field_names.difference(deferred_fields)
|
||||
if loaded_fields:
|
||||
|
|
|
@ -704,7 +704,7 @@ class AutoField(Field):
|
|||
|
||||
def __init__(self, *args, **kwargs):
|
||||
assert kwargs.get('primary_key', False) is True, \
|
||||
"%ss must have primary_key=True." % self.__class__.__name__
|
||||
"%ss must have primary_key=True." % self.__class__.__name__
|
||||
kwargs['blank'] = True
|
||||
Field.__init__(self, *args, **kwargs)
|
||||
|
||||
|
@ -746,7 +746,7 @@ class AutoField(Field):
|
|||
|
||||
def contribute_to_class(self, cls, name):
|
||||
assert not cls._meta.has_auto_field, \
|
||||
"A model can't have more than one AutoField."
|
||||
"A model can't have more than one AutoField."
|
||||
super(AutoField, self).contribute_to_class(cls, name)
|
||||
cls._meta.has_auto_field = True
|
||||
cls._meta.auto_field = self
|
||||
|
|
|
@ -1247,8 +1247,8 @@ class ForeignKey(ForeignObject):
|
|||
|
||||
using = router.db_for_read(model_instance.__class__, instance=model_instance)
|
||||
qs = self.rel.to._default_manager.using(using).filter(
|
||||
**{self.rel.field_name: value}
|
||||
)
|
||||
**{self.rel.field_name: value}
|
||||
)
|
||||
qs = qs.complex_filter(self.rel.limit_choices_to)
|
||||
if not qs.exists():
|
||||
raise exceptions.ValidationError(
|
||||
|
|
|
@ -515,7 +515,7 @@ filter_raw_string = r"""
|
|||
'var_chars': "\w\.",
|
||||
'filter_sep': re.escape(FILTER_SEPARATOR),
|
||||
'arg_sep': re.escape(FILTER_ARGUMENT_SEPARATOR),
|
||||
}
|
||||
}
|
||||
|
||||
filter_re = re.compile(filter_raw_string, re.UNICODE | re.VERBOSE)
|
||||
|
||||
|
|
|
@ -282,8 +282,7 @@ class SimpleTestCase(unittest.TestCase):
|
|||
" response code was %d (expected %d)" %
|
||||
(path, redirect_response.status_code, target_status_code))
|
||||
|
||||
e_scheme, e_netloc, e_path, e_query, e_fragment = urlsplit(
|
||||
expected_url)
|
||||
e_scheme, e_netloc, e_path, e_query, e_fragment = urlsplit(expected_url)
|
||||
if not (e_scheme or e_netloc):
|
||||
expected_url = urlunsplit(('http', host or 'testserver', e_path,
|
||||
e_query, e_fragment))
|
||||
|
@ -850,10 +849,10 @@ class TestCase(TransactionTestCase):
|
|||
try:
|
||||
call_command('loaddata', *self.fixtures,
|
||||
**{
|
||||
'verbosity': 0,
|
||||
'commit': False,
|
||||
'database': db_name,
|
||||
'skip_validation': True,
|
||||
'verbosity': 0,
|
||||
'commit': False,
|
||||
'database': db_name,
|
||||
'skip_validation': True,
|
||||
})
|
||||
except Exception:
|
||||
self._fixture_teardown()
|
||||
|
|
|
@ -145,12 +145,12 @@ class JsLexer(Lexer):
|
|||
states = {
|
||||
'div': # slash will mean division
|
||||
both_before + [
|
||||
Tok("punct", literals("/= /"), next='reg'),
|
||||
Tok("punct", literals("/= /"), next='reg'),
|
||||
] + both_after,
|
||||
|
||||
'reg': # slash will mean regex
|
||||
both_before + [
|
||||
Tok("regex",
|
||||
Tok("regex",
|
||||
r"""
|
||||
/ # opening slash
|
||||
# First character is..
|
||||
|
|
|
@ -65,8 +65,9 @@ def sensitive_post_parameters(*parameters):
|
|||
@functools.wraps(view)
|
||||
def sensitive_post_parameters_wrapper(request, *args, **kwargs):
|
||||
assert isinstance(request, HttpRequest), (
|
||||
"sensitive_post_parameters didn't receive an HttpRequest. If you "
|
||||
"are decorating a classmethod, be sure to use @method_decorator."
|
||||
"sensitive_post_parameters didn't receive an HttpRequest. "
|
||||
"If you are decorating a classmethod, be sure to use "
|
||||
"@method_decorator."
|
||||
)
|
||||
if parameters:
|
||||
request.sensitive_post_parameters = parameters
|
||||
|
|
|
@ -226,8 +226,8 @@ latex_elements = {
|
|||
# (source start file, target name, title, author, document class [howto/manual]).
|
||||
#latex_documents = []
|
||||
latex_documents = [
|
||||
('contents', 'django.tex', 'Django Documentation',
|
||||
'Django Software Foundation', 'manual'),
|
||||
('contents', 'django.tex', 'Django Documentation',
|
||||
'Django Software Foundation', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
|
|
|
@ -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
|
||||
ignore=E123,E124,E125,E126,E127,E128,E225,E226,E241,E251,E302,E501,E121,E122,E203,E221,E227,E231,E261,E301,E303,E502,F401,F403,F841,W601
|
||||
ignore=E123,E124,E125,E126,E127,E128,E225,E226,E241,E251,E302,E501,E203,E221,E227,E231,E261,E301,E303,E502,F401,F403,F841,W601
|
||||
|
||||
[metadata]
|
||||
license-file = LICENSE
|
||||
|
|
|
@ -94,8 +94,8 @@ class BulkCreateTests(TestCase):
|
|||
with override_settings(DEBUG=True):
|
||||
connection.queries = []
|
||||
TwoFields.objects.bulk_create([
|
||||
TwoFields(f1=i, f2=i+1) for i in range(0, 1001)
|
||||
])
|
||||
TwoFields(f1=i, f2=i+1) for i in range(0, 1001)
|
||||
])
|
||||
self.assertEqual(TwoFields.objects.count(), 1001)
|
||||
self.assertEqual(
|
||||
TwoFields.objects.filter(f1__gte=450, f1__lte=550).count(),
|
||||
|
@ -115,8 +115,8 @@ class BulkCreateTests(TestCase):
|
|||
with override_settings(DEBUG=True):
|
||||
connection.queries = []
|
||||
TwoFields.objects.bulk_create([
|
||||
TwoFields(f1=i, f2=i+1) for i in range(0, 1001)
|
||||
])
|
||||
TwoFields(f1=i, f2=i+1) for i in range(0, 1001)
|
||||
])
|
||||
self.assertTrue(len(connection.queries) < 10)
|
||||
|
||||
def test_large_batch_mixed(self):
|
||||
|
|
|
@ -867,7 +867,7 @@ class DBCacheTests(BaseCacheTests, TransactionTestCase):
|
|||
def test_second_call_doesnt_crash(self):
|
||||
stdout = six.StringIO()
|
||||
management.call_command(
|
||||
'createcachetable',
|
||||
'createcachetable',
|
||||
stdout=stdout
|
||||
)
|
||||
self.assertEqual(stdout.getvalue(),
|
||||
|
|
|
@ -306,14 +306,14 @@ class ExtraRegressTests(TestCase):
|
|||
|
||||
self.assertQuerysetEqual(
|
||||
TestObject.objects.filter(
|
||||
pk__in=TestObject.objects.values('pk').extra(select={'extra': 1})
|
||||
pk__in=TestObject.objects.values('pk').extra(select={'extra': 1})
|
||||
),
|
||||
['<TestObject: TestObject: first,second,third>']
|
||||
)
|
||||
|
||||
self.assertQuerysetEqual(
|
||||
TestObject.objects.filter(pk=obj.pk) |
|
||||
TestObject.objects.extra(where=["id > %s"], params=[obj.pk]),
|
||||
TestObject.objects.extra(where=["id > %s"], params=[obj.pk]),
|
||||
['<TestObject: TestObject: first,second,third>']
|
||||
)
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class FormsMediaTestCase(TestCase):
|
|||
|
||||
class Foo:
|
||||
css = {
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
}
|
||||
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
|
||||
|
||||
|
@ -52,7 +52,7 @@ class FormsMediaTestCase(TestCase):
|
|||
class MyWidget1(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
}
|
||||
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
|
||||
|
||||
|
@ -77,21 +77,21 @@ class FormsMediaTestCase(TestCase):
|
|||
class MyWidget1(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
}
|
||||
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
|
||||
|
||||
class MyWidget2(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('/path/to/css2','/path/to/css3')
|
||||
'all': ('/path/to/css2','/path/to/css3')
|
||||
}
|
||||
js = ('/path/to/js1','/path/to/js4')
|
||||
|
||||
class MyWidget3(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
}
|
||||
js = ('/path/to/js1','/path/to/js4')
|
||||
|
||||
|
@ -158,7 +158,7 @@ class FormsMediaTestCase(TestCase):
|
|||
class MyWidget1(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
}
|
||||
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
|
||||
|
||||
|
@ -185,7 +185,7 @@ class FormsMediaTestCase(TestCase):
|
|||
class MyWidget1(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
}
|
||||
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
|
||||
|
||||
|
@ -203,7 +203,7 @@ class FormsMediaTestCase(TestCase):
|
|||
class MyWidget8(MyWidget1):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
}
|
||||
js = ('/path/to/js1','/path/to/js4')
|
||||
|
||||
|
@ -222,7 +222,7 @@ class FormsMediaTestCase(TestCase):
|
|||
class MyWidget1(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
}
|
||||
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
|
||||
|
||||
|
@ -249,7 +249,7 @@ class FormsMediaTestCase(TestCase):
|
|||
class Media:
|
||||
extend = False
|
||||
css = {
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
}
|
||||
js = ('/path/to/js1','/path/to/js4')
|
||||
|
||||
|
@ -264,7 +264,7 @@ class FormsMediaTestCase(TestCase):
|
|||
class MyWidget1(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
}
|
||||
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
|
||||
|
||||
|
@ -272,7 +272,7 @@ class FormsMediaTestCase(TestCase):
|
|||
class Media:
|
||||
extend = True
|
||||
css = {
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
}
|
||||
js = ('/path/to/js1','/path/to/js4')
|
||||
|
||||
|
@ -290,7 +290,7 @@ class FormsMediaTestCase(TestCase):
|
|||
class MyWidget1(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
}
|
||||
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
|
||||
|
||||
|
@ -298,7 +298,7 @@ class FormsMediaTestCase(TestCase):
|
|||
class Media:
|
||||
extend = ('css',)
|
||||
css = {
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
}
|
||||
js = ('/path/to/js1','/path/to/js4')
|
||||
|
||||
|
@ -318,9 +318,9 @@ class FormsMediaTestCase(TestCase):
|
|||
class MultimediaWidget(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'screen, print': ('/file1','/file2'),
|
||||
'screen': ('/file3',),
|
||||
'print': ('/file4',)
|
||||
'screen, print': ('/file1','/file2'),
|
||||
'screen': ('/file3',),
|
||||
'print': ('/file4',)
|
||||
}
|
||||
js = ('/path/to/js1','/path/to/js4')
|
||||
|
||||
|
@ -340,21 +340,21 @@ class FormsMediaTestCase(TestCase):
|
|||
class MyWidget1(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
}
|
||||
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
|
||||
|
||||
class MyWidget2(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('/path/to/css2','/path/to/css3')
|
||||
'all': ('/path/to/css2','/path/to/css3')
|
||||
}
|
||||
js = ('/path/to/js1','/path/to/js4')
|
||||
|
||||
class MyWidget3(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
}
|
||||
js = ('/path/to/js1','/path/to/js4')
|
||||
|
||||
|
@ -382,21 +382,21 @@ class FormsMediaTestCase(TestCase):
|
|||
class MyWidget1(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
}
|
||||
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
|
||||
|
||||
class MyWidget2(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('/path/to/css2','/path/to/css3')
|
||||
'all': ('/path/to/css2','/path/to/css3')
|
||||
}
|
||||
js = ('/path/to/js1','/path/to/js4')
|
||||
|
||||
class MyWidget3(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
}
|
||||
js = ('/path/to/js1','/path/to/js4')
|
||||
|
||||
|
@ -474,7 +474,7 @@ class StaticFormsMediaTestCase(TestCase):
|
|||
|
||||
class Foo:
|
||||
css = {
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
}
|
||||
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
|
||||
|
||||
|
@ -503,7 +503,7 @@ class StaticFormsMediaTestCase(TestCase):
|
|||
class MyWidget1(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
}
|
||||
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
|
||||
|
||||
|
@ -528,21 +528,21 @@ class StaticFormsMediaTestCase(TestCase):
|
|||
class MyWidget1(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
}
|
||||
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
|
||||
|
||||
class MyWidget2(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('/path/to/css2','/path/to/css3')
|
||||
'all': ('/path/to/css2','/path/to/css3')
|
||||
}
|
||||
js = ('/path/to/js1','/path/to/js4')
|
||||
|
||||
class MyWidget3(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
}
|
||||
js = ('/path/to/js1','/path/to/js4')
|
||||
|
||||
|
@ -609,7 +609,7 @@ class StaticFormsMediaTestCase(TestCase):
|
|||
class MyWidget1(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
}
|
||||
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
|
||||
|
||||
|
@ -636,7 +636,7 @@ class StaticFormsMediaTestCase(TestCase):
|
|||
class MyWidget1(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
}
|
||||
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
|
||||
|
||||
|
@ -654,7 +654,7 @@ class StaticFormsMediaTestCase(TestCase):
|
|||
class MyWidget8(MyWidget1):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
}
|
||||
js = ('/path/to/js1','/path/to/js4')
|
||||
|
||||
|
@ -673,7 +673,7 @@ class StaticFormsMediaTestCase(TestCase):
|
|||
class MyWidget1(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
}
|
||||
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
|
||||
|
||||
|
@ -700,7 +700,7 @@ class StaticFormsMediaTestCase(TestCase):
|
|||
class Media:
|
||||
extend = False
|
||||
css = {
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
}
|
||||
js = ('/path/to/js1','/path/to/js4')
|
||||
|
||||
|
@ -715,7 +715,7 @@ class StaticFormsMediaTestCase(TestCase):
|
|||
class MyWidget1(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
}
|
||||
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
|
||||
|
||||
|
@ -723,7 +723,7 @@ class StaticFormsMediaTestCase(TestCase):
|
|||
class Media:
|
||||
extend = True
|
||||
css = {
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
}
|
||||
js = ('/path/to/js1','/path/to/js4')
|
||||
|
||||
|
@ -741,7 +741,7 @@ class StaticFormsMediaTestCase(TestCase):
|
|||
class MyWidget1(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
}
|
||||
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
|
||||
|
||||
|
@ -749,7 +749,7 @@ class StaticFormsMediaTestCase(TestCase):
|
|||
class Media:
|
||||
extend = ('css',)
|
||||
css = {
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
}
|
||||
js = ('/path/to/js1','/path/to/js4')
|
||||
|
||||
|
@ -769,9 +769,9 @@ class StaticFormsMediaTestCase(TestCase):
|
|||
class MultimediaWidget(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'screen, print': ('/file1','/file2'),
|
||||
'screen': ('/file3',),
|
||||
'print': ('/file4',)
|
||||
'screen, print': ('/file1','/file2'),
|
||||
'screen': ('/file3',),
|
||||
'print': ('/file4',)
|
||||
}
|
||||
js = ('/path/to/js1','/path/to/js4')
|
||||
|
||||
|
@ -791,21 +791,21 @@ class StaticFormsMediaTestCase(TestCase):
|
|||
class MyWidget1(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
}
|
||||
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
|
||||
|
||||
class MyWidget2(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('/path/to/css2','/path/to/css3')
|
||||
'all': ('/path/to/css2','/path/to/css3')
|
||||
}
|
||||
js = ('/path/to/js1','/path/to/js4')
|
||||
|
||||
class MyWidget3(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
}
|
||||
js = ('/path/to/js1','/path/to/js4')
|
||||
|
||||
|
@ -833,21 +833,21 @@ class StaticFormsMediaTestCase(TestCase):
|
|||
class MyWidget1(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
'all': ('path/to/css1','/path/to/css2')
|
||||
}
|
||||
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
|
||||
|
||||
class MyWidget2(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('/path/to/css2','/path/to/css3')
|
||||
'all': ('/path/to/css2','/path/to/css3')
|
||||
}
|
||||
js = ('/path/to/js1','/path/to/js4')
|
||||
|
||||
class MyWidget3(TextInput):
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
'all': ('/path/to/css3','path/to/css1')
|
||||
}
|
||||
js = ('/path/to/js1','/path/to/js4')
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ class ModelTests(TestCase):
|
|||
datetime.date(1, 3, 3),
|
||||
],
|
||||
attrgetter("when")
|
||||
)
|
||||
)
|
||||
|
||||
if (3,) <= sys.version_info < (3, 3) and connection.vendor == 'mysql':
|
||||
# In Python < 3.3, datetime.strftime raises an exception for years
|
||||
|
|
|
@ -440,9 +440,9 @@ class ForeignKeyToFieldTest(TestCase):
|
|||
with self.assertNumQueries(3):
|
||||
qs = Author.objects.all().prefetch_related('favorite_authors', 'favors_me')
|
||||
favorites = [(
|
||||
[six.text_type(i_like) for i_like in author.favorite_authors.all()],
|
||||
[six.text_type(likes_me) for likes_me in author.favors_me.all()]
|
||||
) for author in qs]
|
||||
[six.text_type(i_like) for i_like in author.favorite_authors.all()],
|
||||
[six.text_type(likes_me) for likes_me in author.favors_me.all()]
|
||||
) for author in qs]
|
||||
self.assertEqual(
|
||||
favorites,
|
||||
[
|
||||
|
|
|
@ -246,9 +246,9 @@ class SerializersTestBase(object):
|
|||
# Regression for #12524 -- dates before 1000AD get prefixed
|
||||
# 0's on the year
|
||||
a = Article.objects.create(
|
||||
author = self.jane,
|
||||
headline = "Nobody remembers the early years",
|
||||
pub_date = datetime(1, 2, 3, 4, 5, 6))
|
||||
author = self.jane,
|
||||
headline = "Nobody remembers the early years",
|
||||
pub_date = datetime(1, 2, 3, 4, 5, 6))
|
||||
|
||||
serial_str = serializers.serialize(self.serializer_name, [a])
|
||||
date_values = self._get_field_values(serial_str, "pub_date")
|
||||
|
|
|
@ -121,13 +121,13 @@ def data_compare(testcase, pk, klass, data):
|
|||
if klass == BinaryData and data is not None:
|
||||
testcase.assertEqual(bytes(data), bytes(instance.data),
|
||||
"Objects with PK=%d not equal; expected '%s' (%s), got '%s' (%s)" % (
|
||||
pk, repr(bytes(data)), type(data), repr(bytes(instance.data)),
|
||||
type(instance.data))
|
||||
pk, repr(bytes(data)), type(data), repr(bytes(instance.data)),
|
||||
type(instance.data))
|
||||
)
|
||||
else:
|
||||
testcase.assertEqual(data, instance.data,
|
||||
"Objects with PK=%d not equal; expected '%s' (%s), got '%s' (%s)" % (
|
||||
pk, data, type(data), instance, type(instance.data))
|
||||
pk, data, type(data), instance, type(instance.data))
|
||||
)
|
||||
|
||||
def generic_compare(testcase, pk, klass, data):
|
||||
|
@ -205,7 +205,7 @@ test_data = [
|
|||
(data_obj, 41, EmailData, None),
|
||||
(data_obj, 42, EmailData, ""),
|
||||
(data_obj, 50, FileData, 'file:///foo/bar/whiz.txt'),
|
||||
# (data_obj, 51, FileData, None),
|
||||
# (data_obj, 51, FileData, None),
|
||||
(data_obj, 52, FileData, ""),
|
||||
(data_obj, 60, FilePathData, "/foo/bar/whiz.txt"),
|
||||
(data_obj, 61, FilePathData, None),
|
||||
|
@ -308,10 +308,10 @@ The end."""),
|
|||
(pk_obj, 601, BooleanPKData, True),
|
||||
(pk_obj, 602, BooleanPKData, False),
|
||||
(pk_obj, 610, CharPKData, "Test Char PKData"),
|
||||
# (pk_obj, 620, DatePKData, datetime.date(2006,6,16)),
|
||||
# (pk_obj, 630, DateTimePKData, datetime.datetime(2006,6,16,10,42,37)),
|
||||
# (pk_obj, 620, DatePKData, datetime.date(2006,6,16)),
|
||||
# (pk_obj, 630, DateTimePKData, datetime.datetime(2006,6,16,10,42,37)),
|
||||
(pk_obj, 640, EmailPKData, "hovercraft@example.com"),
|
||||
# (pk_obj, 650, FilePKData, 'file:///foo/bar/whiz.txt'),
|
||||
# (pk_obj, 650, FilePKData, 'file:///foo/bar/whiz.txt'),
|
||||
(pk_obj, 660, FilePathPKData, "/foo/bar/whiz.txt"),
|
||||
(pk_obj, 670, DecimalPKData, decimal.Decimal('12.345')),
|
||||
(pk_obj, 671, DecimalPKData, decimal.Decimal('-12.345')),
|
||||
|
@ -322,7 +322,7 @@ The end."""),
|
|||
(pk_obj, 680, IntegerPKData, 123456789),
|
||||
(pk_obj, 681, IntegerPKData, -123456789),
|
||||
(pk_obj, 682, IntegerPKData, 0),
|
||||
# (XX, ImagePKData
|
||||
# (XX, ImagePKData
|
||||
(pk_obj, 690, IPAddressPKData, "127.0.0.1"),
|
||||
(pk_obj, 695, GenericIPAddressPKData, "fe80:1424:2223:6cff:fe8a:2e8a:2151:abcd"),
|
||||
# (pk_obj, 700, NullBooleanPKData, True),
|
||||
|
@ -333,12 +333,12 @@ The end."""),
|
|||
(pk_obj, 750, SmallPKData, 12),
|
||||
(pk_obj, 751, SmallPKData, -12),
|
||||
(pk_obj, 752, SmallPKData, 0),
|
||||
# (pk_obj, 760, TextPKData, """This is a long piece of text.
|
||||
# It contains line breaks.
|
||||
# Several of them.
|
||||
# The end."""),
|
||||
# (pk_obj, 770, TimePKData, datetime.time(10,42,37)),
|
||||
# (pk_obj, 790, XMLPKData, "<foo></foo>"),
|
||||
# (pk_obj, 760, TextPKData, """This is a long piece of text.
|
||||
# It contains line breaks.
|
||||
# Several of them.
|
||||
# The end."""),
|
||||
# (pk_obj, 770, TimePKData, datetime.time(10,42,37)),
|
||||
# (pk_obj, 790, XMLPKData, "<foo></foo>"),
|
||||
|
||||
(data_obj, 800, AutoNowDateTimeData, datetime.datetime(2006,6,16,10,42,37)),
|
||||
(data_obj, 810, ModifyingSaveData, 42),
|
||||
|
|
|
@ -45,9 +45,9 @@ class SignalsRegressTests(TestCase):
|
|||
# Save up the number of connected signals so that we can check at the end
|
||||
# that all the signals we register get properly unregistered (#9989)
|
||||
self.pre_signals = (len(models.signals.pre_save.receivers),
|
||||
len(models.signals.post_save.receivers),
|
||||
len(models.signals.pre_delete.receivers),
|
||||
len(models.signals.post_delete.receivers))
|
||||
len(models.signals.post_save.receivers),
|
||||
len(models.signals.pre_delete.receivers),
|
||||
len(models.signals.post_delete.receivers))
|
||||
|
||||
models.signals.pre_save.connect(self.pre_save_test)
|
||||
models.signals.post_save.connect(self.post_save_test)
|
||||
|
|
|
@ -371,12 +371,12 @@ def get_filter_tests():
|
|||
'time05': (r'{{ d|time:"P:e:O:T:Z" }}', {'d': today}, ''),
|
||||
'time06': (r'{{ obj|time:"P:e:O:T:Z" }}', {'obj': 'non-datetime-value'}, ''),
|
||||
|
||||
# Tests for #11687 and #16676
|
||||
'add01': (r'{{ i|add:"5" }}', {'i': 2000}, '2005'),
|
||||
'add02': (r'{{ i|add:"napis" }}', {'i': 2000}, ''),
|
||||
'add03': (r'{{ i|add:16 }}', {'i': 'not_an_int'}, ''),
|
||||
'add04': (r'{{ i|add:"16" }}', {'i': 'not_an_int'}, 'not_an_int16'),
|
||||
'add05': (r'{{ l1|add:l2 }}', {'l1': [1, 2], 'l2': [3, 4]}, '[1, 2, 3, 4]'),
|
||||
'add06': (r'{{ t1|add:t2 }}', {'t1': (3, 4), 't2': (1, 2)}, '(3, 4, 1, 2)'),
|
||||
'add07': (r'{{ d|add:t }}', {'d': date(2000, 1, 1), 't': timedelta(10)}, 'Jan. 11, 2000'),
|
||||
# Tests for #11687 and #16676
|
||||
'add01': (r'{{ i|add:"5" }}', {'i': 2000}, '2005'),
|
||||
'add02': (r'{{ i|add:"napis" }}', {'i': 2000}, ''),
|
||||
'add03': (r'{{ i|add:16 }}', {'i': 'not_an_int'}, ''),
|
||||
'add04': (r'{{ i|add:"16" }}', {'i': 'not_an_int'}, 'not_an_int16'),
|
||||
'add05': (r'{{ l1|add:l2 }}', {'l1': [1, 2], 'l2': [3, 4]}, '[1, 2, 3, 4]'),
|
||||
'add06': (r'{{ t1|add:t2 }}', {'t1': (3, 4), 't2': (1, 2)}, '(3, 4, 1, 2)'),
|
||||
'add07': (r'{{ d|add:t }}', {'d': date(2000, 1, 1), 't': timedelta(10)}, 'Jan. 11, 2000'),
|
||||
}
|
||||
|
|
|
@ -397,13 +397,13 @@ class HTMLEqualTests(TestCase):
|
|||
|
||||
def test_complex_examples(self):
|
||||
self.assertHTMLEqual(
|
||||
"""<tr><th><label for="id_first_name">First name:</label></th>
|
||||
"""<tr><th><label for="id_first_name">First name:</label></th>
|
||||
<td><input type="text" name="first_name" value="John" id="id_first_name" /></td></tr>
|
||||
<tr><th><label for="id_last_name">Last name:</label></th>
|
||||
<td><input type="text" id="id_last_name" name="last_name" value="Lennon" /></td></tr>
|
||||
<tr><th><label for="id_birthday">Birthday:</label></th>
|
||||
<td><input type="text" value="1940-10-9" name="birthday" id="id_birthday" /></td></tr>""",
|
||||
"""
|
||||
"""
|
||||
<tr><th>
|
||||
<label for="id_first_name">First name:</label></th><td><input type="text" name="first_name" value="John" id="id_first_name" />
|
||||
</td></tr>
|
||||
|
@ -416,7 +416,7 @@ class HTMLEqualTests(TestCase):
|
|||
""")
|
||||
|
||||
self.assertHTMLEqual(
|
||||
"""<!DOCTYPE html>
|
||||
"""<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet">
|
||||
|
|
Loading…
Reference in New Issue