diff --git a/django/apps/registry.py b/django/apps/registry.py
index aff58db1c4..f522550d60 100644
--- a/django/apps/registry.py
+++ b/django/apps/registry.py
@@ -300,7 +300,7 @@ class Apps:
This method is safe in the sense that it doesn't trigger any imports.
"""
available = set(available)
- installed = set(app_config.name for app_config in self.get_app_configs())
+ installed = {app_config.name for app_config in self.get_app_configs()}
if not available.issubset(installed):
raise ValueError(
"Available apps isn't a subset of installed apps, extra apps: %s"
diff --git a/django/contrib/admin/templatetags/admin_urls.py b/django/contrib/admin/templatetags/admin_urls.py
index 097fbcf040..b926fe447a 100644
--- a/django/contrib/admin/templatetags/admin_urls.py
+++ b/django/contrib/admin/templatetags/admin_urls.py
@@ -25,7 +25,7 @@ def add_preserved_filters(context, url, popup=False, to_field=None):
parsed_url = list(urlparse(url))
parsed_qs = dict(parse_qsl(parsed_url[4]))
- merged_qs = dict()
+ merged_qs = {}
if opts and preserved_filters:
preserved_filters = dict(parse_qsl(preserved_filters))
diff --git a/django/contrib/auth/backends.py b/django/contrib/auth/backends.py
index 7f5962b43c..52b80f8c49 100644
--- a/django/contrib/auth/backends.py
+++ b/django/contrib/auth/backends.py
@@ -54,7 +54,7 @@ class ModelBackend:
else:
perms = getattr(self, '_get_%s_permissions' % from_name)(user_obj)
perms = perms.values_list('content_type__app_label', 'codename').order_by()
- setattr(user_obj, perm_cache_name, set("%s.%s" % (ct, name) for ct, name in perms))
+ setattr(user_obj, perm_cache_name, {"%s.%s" % (ct, name) for ct, name in perms})
return getattr(user_obj, perm_cache_name)
def get_user_permissions(self, user_obj, obj=None):
diff --git a/django/contrib/auth/management/__init__.py b/django/contrib/auth/management/__init__.py
index 922a6a3f28..36a2a7038f 100644
--- a/django/contrib/auth/management/__init__.py
+++ b/django/contrib/auth/management/__init__.py
@@ -50,7 +50,7 @@ def create_permissions(app_config, verbosity=2, interactive=True, using=DEFAULT_
# This will hold the permissions we're looking for as
# (content_type, (codename, name))
- searched_perms = list()
+ searched_perms = []
# The codenames and ctypes that should exist.
ctypes = set()
for klass in app_config.get_models():
diff --git a/django/contrib/contenttypes/fields.py b/django/contrib/contenttypes/fields.py
index fc269bbc73..e4e759502c 100644
--- a/django/contrib/contenttypes/fields.py
+++ b/django/contrib/contenttypes/fields.py
@@ -529,7 +529,7 @@ def create_generic_related_manager(superclass, rel):
query = {
'%s__pk' % self.content_type_field_name: self.content_type.id,
- '%s__in' % self.object_id_field_name: set(obj._get_pk_val() for obj in instances)
+ '%s__in' % self.object_id_field_name: {obj._get_pk_val() for obj in instances}
}
# We (possibly) need to convert object IDs to the type of the
diff --git a/django/contrib/flatpages/templatetags/flatpages.py b/django/contrib/flatpages/templatetags/flatpages.py
index 09260ebaa8..985083d363 100644
--- a/django/contrib/flatpages/templatetags/flatpages.py
+++ b/django/contrib/flatpages/templatetags/flatpages.py
@@ -72,7 +72,7 @@ def get_flatpages(parser, token):
bits = token.split_contents()
syntax_message = ("%(tag_name)s expects a syntax of %(tag_name)s "
"['url_starts_with'] [for user] as context_name" %
- dict(tag_name=bits[0]))
+ {'tag_name': bits[0]})
# Must have at 3-6 bits in the tag
if len(bits) >= 3 and len(bits) <= 6:
diff --git a/django/core/cache/backends/memcached.py b/django/core/cache/backends/memcached.py
index 6e8211bdff..acc0613e6b 100644
--- a/django/core/cache/backends/memcached.py
+++ b/django/core/cache/backends/memcached.py
@@ -159,7 +159,7 @@ class MemcachedCache(BaseMemcachedCache):
@property
def _cache(self):
if getattr(self, '_client', None) is None:
- client_kwargs = dict(pickleProtocol=pickle.HIGHEST_PROTOCOL)
+ client_kwargs = {'pickleProtocol': pickle.HIGHEST_PROTOCOL}
client_kwargs.update(self._options)
self._client = self._lib.Client(self._servers, **client_kwargs)
return self._client
diff --git a/django/core/management/base.py b/django/core/management/base.py
index 857c15fb60..61ce6ebec5 100644
--- a/django/core/management/base.py
+++ b/django/core/management/base.py
@@ -428,7 +428,7 @@ class BaseCommand:
plan = executor.migration_plan(executor.loader.graph.leaf_nodes())
if plan:
- apps_waiting_migration = sorted(set(migration.app_label for migration, backwards in plan))
+ apps_waiting_migration = sorted({migration.app_label for migration, backwards in plan})
self.stdout.write(
self.style.NOTICE(
"\nYou have %(unpplied_migration_count)s unapplied migration(s). "
diff --git a/django/core/management/commands/loaddata.py b/django/core/management/commands/loaddata.py
index 49679599a2..786957e86f 100644
--- a/django/core/management/commands/loaddata.py
+++ b/django/core/management/commands/loaddata.py
@@ -235,7 +235,7 @@ class Command(BaseCommand):
'.'.join(ext for ext in combo if ext)
for combo in product(databases, ser_fmts, cmp_fmts)
)
- targets = set('.'.join((fixture_name, suffix)) for suffix in suffixes)
+ targets = {'.'.join((fixture_name, suffix)) for suffix in suffixes}
fixture_files = []
for fixture_dir in fixture_dirs:
diff --git a/django/core/management/commands/makemigrations.py b/django/core/management/commands/makemigrations.py
index 013b6035b7..45fce19b0f 100644
--- a/django/core/management/commands/makemigrations.py
+++ b/django/core/management/commands/makemigrations.py
@@ -78,7 +78,7 @@ class Command(BaseCommand):
loader = MigrationLoader(None, ignore_no_migrations=True)
# Raise an error if any migrations are applied before their dependencies.
- consistency_check_labels = set(config.label for config in apps.get_app_configs())
+ consistency_check_labels = {config.label for config in apps.get_app_configs()}
# Non-default databases are only checked if database routers used.
aliases_to_check = connections if settings.DATABASE_ROUTERS else [DEFAULT_DB_ALIAS]
for alias in sorted(aliases_to_check):
diff --git a/django/core/management/commands/migrate.py b/django/core/management/commands/migrate.py
index eb50026eab..e549b7200b 100644
--- a/django/core/management/commands/migrate.py
+++ b/django/core/management/commands/migrate.py
@@ -143,7 +143,7 @@ class Command(BaseCommand):
if target_app_labels_only:
self.stdout.write(
self.style.MIGRATE_LABEL(" Apply all migrations: ") +
- (", ".join(sorted(set(a for a, n in targets))) or "(none)")
+ (", ".join(sorted({a for a, n in targets})) or "(none)")
)
else:
if targets[0][1] is None:
diff --git a/django/db/backends/base/schema.py b/django/db/backends/base/schema.py
index 7e338d690f..7e3163fbfc 100644
--- a/django/db/backends/base/schema.py
+++ b/django/db/backends/base/schema.py
@@ -324,8 +324,8 @@ class BaseDatabaseSchemaEditor:
unique_togethers must be doubly-nested, not the single-nested
["foo", "bar"] format.
"""
- olds = set(tuple(fields) for fields in old_unique_together)
- news = set(tuple(fields) for fields in new_unique_together)
+ olds = {tuple(fields) for fields in old_unique_together}
+ news = {tuple(fields) for fields in new_unique_together}
# Deleted uniques
for fields in olds.difference(news):
self._delete_composed_index(model, fields, {'unique': True}, self.sql_delete_unique)
@@ -340,8 +340,8 @@ class BaseDatabaseSchemaEditor:
index_togethers must be doubly-nested, not the single-nested
["foo", "bar"] format.
"""
- olds = set(tuple(fields) for fields in old_index_together)
- news = set(tuple(fields) for fields in new_index_together)
+ olds = {tuple(fields) for fields in old_index_together}
+ news = {tuple(fields) for fields in new_index_together}
# Deleted indexes
for fields in olds.difference(news):
self._delete_composed_index(model, fields, {'index': True}, self.sql_delete_index)
diff --git a/django/db/backends/sqlite3/schema.py b/django/db/backends/sqlite3/schema.py
index edc6331cb7..10d7c623f8 100644
--- a/django/db/backends/sqlite3/schema.py
+++ b/django/db/backends/sqlite3/schema.py
@@ -169,7 +169,7 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
'indexes': indexes,
'apps': apps,
}
- meta = type("Meta", tuple(), meta_contents)
+ meta = type("Meta", (), meta_contents)
body['Meta'] = meta
body['__module__'] = model.__module__
diff --git a/django/db/migrations/autodetector.py b/django/db/migrations/autodetector.py
index 3804cfd959..3a49e26c92 100644
--- a/django/db/migrations/autodetector.py
+++ b/django/db/migrations/autodetector.py
@@ -1065,14 +1065,14 @@ class MigrationAutodetector:
old_model_name = self.renamed_models.get((app_label, model_name), model_name)
old_model_state = self.from_state.models[app_label, old_model_name]
new_model_state = self.to_state.models[app_label, model_name]
- old_options = dict(
- option for option in old_model_state.options.items()
- if option[0] in AlterModelOptions.ALTER_OPTION_KEYS
- )
- new_options = dict(
- option for option in new_model_state.options.items()
- if option[0] in AlterModelOptions.ALTER_OPTION_KEYS
- )
+ old_options = {
+ key: value for key, value in old_model_state.options.items()
+ if key in AlterModelOptions.ALTER_OPTION_KEYS
+ }
+ new_options = {
+ key: value for key, value in new_model_state.options.items()
+ if key in AlterModelOptions.ALTER_OPTION_KEYS
+ }
if old_options != new_options:
self.add_operation(
app_label,
diff --git a/django/db/migrations/operations/models.py b/django/db/migrations/operations/models.py
index 08cf6e314b..7daf8a7eec 100644
--- a/django/db/migrations/operations/models.py
+++ b/django/db/migrations/operations/models.py
@@ -496,7 +496,7 @@ class AlterUniqueTogether(FieldRelatedOptionOperation):
def __init__(self, name, unique_together):
unique_together = normalize_together(unique_together)
- self.unique_together = set(tuple(cons) for cons in unique_together)
+ self.unique_together = {tuple(cons) for cons in unique_together}
super().__init__(name)
def deconstruct(self):
@@ -550,7 +550,7 @@ class AlterIndexTogether(FieldRelatedOptionOperation):
def __init__(self, name, index_together):
index_together = normalize_together(index_together)
- self.index_together = set(tuple(cons) for cons in index_together)
+ self.index_together = {tuple(cons) for cons in index_together}
super().__init__(name)
def deconstruct(self):
diff --git a/django/db/migrations/recorder.py b/django/db/migrations/recorder.py
index 1b4508ff85..dcc27d525c 100644
--- a/django/db/migrations/recorder.py
+++ b/django/db/migrations/recorder.py
@@ -55,7 +55,7 @@ class MigrationRecorder:
def applied_migrations(self):
"""Return a set of (app, name) of applied migrations."""
self.ensure_schema()
- return set(tuple(x) for x in self.migration_qs.values_list("app", "name"))
+ return {tuple(x) for x in self.migration_qs.values_list("app", "name")}
def record_applied(self, app, name):
"""Record that a migration was applied."""
diff --git a/django/db/migrations/state.py b/django/db/migrations/state.py
index a4027ef6f1..0578badabe 100644
--- a/django/db/migrations/state.py
+++ b/django/db/migrations/state.py
@@ -559,7 +559,7 @@ class ModelState:
# First, make a Meta object
meta_contents = {'app_label': self.app_label, "apps": apps}
meta_contents.update(self.options)
- meta = type("Meta", tuple(), meta_contents)
+ meta = type("Meta", (), meta_contents)
# Then, work out our bases
try:
bases = tuple(
diff --git a/django/db/models/base.py b/django/db/models/base.py
index 11887d4a9d..16c7d3636f 100644
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -1294,7 +1294,7 @@ class Model(metaclass=ModelBase):
@classmethod
def _check_id_field(cls):
"""Check if `id` field is a primary key."""
- fields = list(f for f in cls._meta.local_fields if f.name == 'id' and f != cls._meta.pk)
+ fields = [f for f in cls._meta.local_fields if f.name == 'id' and f != cls._meta.pk]
# fields is empty or consists of the invalid "id" field
if fields and not fields[0].primary_key and cls._meta.pk.name == 'id':
return [
diff --git a/django/db/models/fields/related_descriptors.py b/django/db/models/fields/related_descriptors.py
index 542cafb6bd..86da637f26 100644
--- a/django/db/models/fields/related_descriptors.py
+++ b/django/db/models/fields/related_descriptors.py
@@ -122,7 +122,7 @@ class ForwardManyToOneDescriptor:
# The check for len(...) == 1 is a special case that allows the query
# to be join-less and smaller. Refs #21760.
if self.field.remote_field.is_hidden() or len(self.field.foreign_related_fields) == 1:
- query = {'%s__in' % related_field.name: set(instance_attr(inst)[0] for inst in instances)}
+ query = {'%s__in' % related_field.name: {instance_attr(inst)[0] for inst in instances}}
else:
query = {'%s__in' % self.field.related_query_name(): instances}
queryset = queryset.filter(**query)
diff --git a/django/db/models/options.py b/django/db/models/options.py
index d1439f7973..82d96b739c 100644
--- a/django/db/models/options.py
+++ b/django/db/models/options.py
@@ -20,7 +20,7 @@ from django.utils.translation import override
PROXY_PARENTS = object()
-EMPTY_RELATION_TREE = tuple()
+EMPTY_RELATION_TREE = ()
IMMUTABLE_WARNING = (
"The return type of '%s' should never be mutated. If you want to manipulate this list "
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 39f40d604d..d53bd7758c 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -1251,8 +1251,7 @@ class Query:
# (Consider case where rel_a is LOUTER and rel_a__col=1 is added - if
# rel_a doesn't produce any rows, then the whole condition must fail.
# So, demotion is OK.
- existing_inner = set(
- (a for a in self.alias_map if self.alias_map[a].join_type == INNER))
+ existing_inner = {a for a in self.alias_map if self.alias_map[a].join_type == INNER}
clause, _ = self._add_q(q_object, self.used_aliases)
if clause:
self.where.add(clause, AND)
@@ -1437,8 +1436,8 @@ class Query:
for pos, info in enumerate(reversed(path)):
if len(joins) == 1 or not info.direct:
break
- join_targets = set(t.column for t in info.join_field.foreign_related_fields)
- cur_targets = set(t.column for t in targets)
+ join_targets = {t.column for t in info.join_field.foreign_related_fields}
+ cur_targets = {t.column for t in targets}
if not cur_targets.issubset(join_targets):
break
targets_dict = {r[1].column: r[0] for r in info.join_field.related_fields if r[1].column in cur_targets}
diff --git a/django/forms/boundfield.py b/django/forms/boundfield.py
index 128d9ce80a..771661ba6a 100644
--- a/django/forms/boundfield.py
+++ b/django/forms/boundfield.py
@@ -47,10 +47,10 @@ class BoundField:
id_ = self.field.widget.attrs.get('id') or self.auto_id
attrs = {'id': id_} if id_ else {}
attrs = self.build_widget_attrs(attrs)
- return list(
+ return [
BoundWidget(self.field.widget, widget, self.form.renderer)
for widget in self.field.widget.subwidgets(self.html_name, self.value(), attrs=attrs)
- )
+ ]
def __bool__(self):
# BoundField evaluates to True even if it doesn't have subwidgets.
diff --git a/django/forms/fields.py b/django/forms/fields.py
index d665606745..eb16f2c353 100644
--- a/django/forms/fields.py
+++ b/django/forms/fields.py
@@ -873,8 +873,8 @@ class MultipleChoiceField(ChoiceField):
data = []
if len(initial) != len(data):
return True
- initial_set = set(str(value) for value in initial)
- data_set = set(str(value) for value in data)
+ initial_set = {str(value) for value in initial}
+ data_set = {str(value) for value in data}
return data_set != initial_set
diff --git a/django/forms/models.py b/django/forms/models.py
index f4c415ed4f..98b56392d0 100644
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -1289,7 +1289,7 @@ class ModelMultipleChoiceField(ModelChoiceField):
params={'pk': pk},
)
qs = self.queryset.filter(**{'%s__in' % key: value})
- pks = set(str(getattr(o, key)) for o in qs)
+ pks = {str(getattr(o, key)) for o in qs}
for val in value:
if str(val) not in pks:
raise ValidationError(
@@ -1313,8 +1313,8 @@ class ModelMultipleChoiceField(ModelChoiceField):
data = []
if len(initial) != len(data):
return True
- initial_set = set(str(value) for value in self.prepare_value(initial))
- data_set = set(str(value) for value in data)
+ initial_set = {str(value) for value in self.prepare_value(initial)}
+ data_set = {str(value) for value in data}
return data_set != initial_set
diff --git a/django/utils/cache.py b/django/utils/cache.py
index 7e7428f112..e8576b539f 100644
--- a/django/utils/cache.py
+++ b/django/utils/cache.py
@@ -287,7 +287,7 @@ def patch_vary_headers(response, newheaders):
else:
vary_headers = []
# Use .lower() here so we treat headers as case-insensitive.
- existing_headers = set(header.lower() for header in vary_headers)
+ existing_headers = {header.lower() for header in vary_headers}
additional_headers = [newheader for newheader in newheaders
if newheader.lower() not in existing_headers]
response['Vary'] = ', '.join(vary_headers + additional_headers)
@@ -300,7 +300,7 @@ def has_vary_header(response, header_query):
if not response.has_header('Vary'):
return False
vary_headers = cc_delim_re.split(response['Vary'])
- existing_headers = set(header.lower() for header in vary_headers)
+ existing_headers = {header.lower() for header in vary_headers}
return header_query.lower() in existing_headers
diff --git a/django/views/i18n.py b/django/views/i18n.py
index 71f8cd575e..9edf83e857 100644
--- a/django/views/i18n.py
+++ b/django/views/i18n.py
@@ -230,7 +230,7 @@ class JavaScriptCatalog(View):
return self.render_to_response(context)
def get_paths(self, packages):
- allowable_packages = dict((app_config.name, app_config) for app_config in apps.get_app_configs())
+ allowable_packages = {app_config.name: app_config for app_config in apps.get_app_configs()}
app_configs = [allowable_packages[p] for p in packages if p in allowable_packages]
# paths of requested packages
return [os.path.join(app.path, 'locale') for app in app_configs]
diff --git a/docs/_ext/djangodocs.py b/docs/_ext/djangodocs.py
index 7ccf0a0715..66e87cdddf 100644
--- a/docs/_ext/djangodocs.py
+++ b/docs/_ext/djangodocs.py
@@ -250,8 +250,7 @@ class DjangoHTMLTranslator(HTMLTranslator):
self.first_param = 1
self.optional_param_level = 0
self.param_separator = node.child_text_separator
- self.required_params_left = sum([isinstance(c, addnodes.desc_parameter)
- for c in node.children])
+ self.required_params_left = sum(isinstance(c, addnodes.desc_parameter) for c in node.children)
def depart_desc_parameterlist(self, node):
self.body.append(')')
diff --git a/scripts/manage_translations.py b/scripts/manage_translations.py
index 74534d47da..5397d35bae 100644
--- a/scripts/manage_translations.py
+++ b/scripts/manage_translations.py
@@ -114,7 +114,7 @@ def lang_stats(resources=None, languages=None):
for name, dir_ in locale_dirs:
print("\nShowing translations stats for '%s':" % name)
- langs = sorted([d for d in os.listdir(dir_) if not d.startswith('_')])
+ langs = sorted(d for d in os.listdir(dir_) if not d.startswith('_'))
for lang in langs:
if languages and lang not in languages:
continue
@@ -142,7 +142,7 @@ def fetch(resources=None, languages=None):
# Transifex pull
if languages is None:
call('tx pull -r %(res)s -a -f --minimum-perc=5' % {'res': _tx_resource_for_name(name)}, shell=True)
- target_langs = sorted([d for d in os.listdir(dir_) if not d.startswith('_') and d != 'en'])
+ target_langs = sorted(d for d in os.listdir(dir_) if not d.startswith('_') and d != 'en')
else:
for lang in languages:
call('tx pull -r %(res)s -f -l %(lang)s' % {
diff --git a/tests/admin_views/urls.py b/tests/admin_views/urls.py
index ca9b165626..d0a671dc00 100644
--- a/tests/admin_views/urls.py
+++ b/tests/admin_views/urls.py
@@ -8,7 +8,7 @@ urlpatterns = [
url(r'^test_admin/admin/secure-view2/$', views.secure_view2, name='secure_view2'),
url(r'^test_admin/admin/', admin.site.urls),
url(r'^test_admin/admin2/', customadmin.site.urls),
- url(r'^test_admin/admin3/', (admin.site.get_urls(), 'admin', 'admin3'), dict(form_url='pony')),
+ url(r'^test_admin/admin3/', (admin.site.get_urls(), 'admin', 'admin3'), {'form_url': 'pony'}),
url(r'^test_admin/admin4/', customadmin.simple_site.urls),
url(r'^test_admin/admin5/', admin.site2.urls),
url(r'^test_admin/admin7/', admin.site7.urls),
diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py
index b7814f966c..d53ac0b435 100644
--- a/tests/admin_widgets/tests.py
+++ b/tests/admin_widgets/tests.py
@@ -564,14 +564,14 @@ class ManyToManyRawIdWidgetTest(TestCase):
w.render('test', [m1.pk, m2.pk], attrs={}), (
''
''
- ) % dict(m1pk=m1.pk, m2pk=m2.pk)
+ ) % {'m1pk': m1.pk, 'm2pk': m2.pk}
)
self.assertHTMLEqual(
w.render('test', [m1.pk]), (
''
''
- ) % dict(m1pk=m1.pk)
+ ) % {'m1pk': m1.pk}
)
def test_m2m_related_model_not_in_admin(self):
diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py
index 8178cb8bcc..8cf0596347 100644
--- a/tests/aggregation/tests.py
+++ b/tests/aggregation/tests.py
@@ -1114,7 +1114,7 @@ class AggregateTestCase(TestCase):
# test completely changing how the output is rendered
def lower_case_function_override(self, compiler, connection):
sql, params = compiler.compile(self.source_expressions[0])
- substitutions = dict(function=self.function.lower(), expressions=sql)
+ substitutions = {'function': self.function.lower(), 'expressions': sql}
substitutions.update(self.extra)
return self.template % substitutions, params
setattr(MySum, 'as_' + connection.vendor, lower_case_function_override)
@@ -1141,7 +1141,7 @@ class AggregateTestCase(TestCase):
# test overriding all parts of the template
def be_evil(self, compiler, connection):
- substitutions = dict(function='MAX', expressions='2')
+ substitutions = {'function': 'MAX', 'expressions': '2'}
substitutions.update(self.extra)
return self.template % substitutions, ()
setattr(MySum, 'as_' + connection.vendor, be_evil)
diff --git a/tests/annotations/tests.py b/tests/annotations/tests.py
index 2ad395e65c..981e73e43e 100644
--- a/tests/annotations/tests.py
+++ b/tests/annotations/tests.py
@@ -197,7 +197,7 @@ class NonAggregateAnnotationTestCase(TestCase):
name_lower=Lower('last_name'),
).distinct('name_lower')
- self.assertEqual(set(p.last_name for p in people), {'Stark', 'Roosevelt'})
+ self.assertEqual({p.last_name for p in people}, {'Stark', 'Roosevelt'})
self.assertEqual(len(people), 2)
people2 = Employee.objects.annotate(
diff --git a/tests/apps/tests.py b/tests/apps/tests.py
index d53719a7fb..50b3927434 100644
--- a/tests/apps/tests.py
+++ b/tests/apps/tests.py
@@ -194,7 +194,7 @@ class AppsTests(SimpleTestCase):
'app_label': "apps",
'apps': new_apps,
}
- meta = type("Meta", tuple(), meta_contents)
+ meta = type("Meta", (), meta_contents)
body['Meta'] = meta
body['__module__'] = TotallyNormal.__module__
temp_model = type("SouthPonies", (models.Model,), body)
@@ -215,7 +215,7 @@ class AppsTests(SimpleTestCase):
}
body = {}
- body['Meta'] = type("Meta", tuple(), meta_contents)
+ body['Meta'] = type("Meta", (), meta_contents)
body['__module__'] = TotallyNormal.__module__
type("SouthPonies", (models.Model,), body)
@@ -223,7 +223,7 @@ class AppsTests(SimpleTestCase):
# was reloaded and issue a warning. This use-case is
# useful for REPL. Refs #23621.
body = {}
- body['Meta'] = type("Meta", tuple(), meta_contents)
+ body['Meta'] = type("Meta", (), meta_contents)
body['__module__'] = TotallyNormal.__module__
msg = (
"Model 'apps.southponies' was already registered. "
@@ -236,7 +236,7 @@ class AppsTests(SimpleTestCase):
# If it doesn't appear to be a reloaded module then we expect
# a RuntimeError.
body = {}
- body['Meta'] = type("Meta", tuple(), meta_contents)
+ body['Meta'] = type("Meta", (), meta_contents)
body['__module__'] = TotallyNormal.__module__ + '.whatever'
with self.assertRaisesMessage(RuntimeError, "Conflicting 'southponies' models in application 'apps':"):
type("SouthPonies", (models.Model,), body)
diff --git a/tests/auth_tests/urls.py b/tests/auth_tests/urls.py
index cd21e6f69d..b69c554bc8 100644
--- a/tests/auth_tests/urls.py
+++ b/tests/auth_tests/urls.py
@@ -75,7 +75,7 @@ urlpatterns = auth_urlpatterns + [
url(r'^password_reset_from_email/$',
views.PasswordResetView.as_view(from_email='staffmember@example.com')),
url(r'^password_reset_extra_email_context/$',
- views.PasswordResetView.as_view(extra_email_context=dict(greeting='Hello!'))),
+ views.PasswordResetView.as_view(extra_email_context={'greeting': 'Hello!'})),
url(r'^password_reset/custom_redirect/$',
views.PasswordResetView.as_view(success_url='/custom/')),
url(r'^password_reset/custom_redirect/named/$',
diff --git a/tests/auth_tests/urls_deprecated.py b/tests/auth_tests/urls_deprecated.py
index 49bb6adb25..7fba46d269 100644
--- a/tests/auth_tests/urls_deprecated.py
+++ b/tests/auth_tests/urls_deprecated.py
@@ -15,21 +15,21 @@ urlpatterns = [
views.password_reset_confirm, name='password_reset_confirm'),
url(r'^reset/done/$', views.password_reset_complete, name='password_reset_complete'),
- url(r'^password_reset_from_email/$', views.password_reset, dict(from_email='staffmember@example.com')),
+ url(r'^password_reset_from_email/$', views.password_reset, {'from_email': 'staffmember@example.com'}),
url(r'^password_reset_extra_email_context/$', views.password_reset,
- dict(extra_email_context=dict(greeting='Hello!'))),
- url(r'^password_reset/custom_redirect/$', views.password_reset, dict(post_reset_redirect='/custom/')),
- url(r'^password_reset/custom_redirect/named/$', views.password_reset, dict(post_reset_redirect='password_reset')),
+ {'extra_email_context': {'greeting': 'Hello!'}}),
+ url(r'^password_reset/custom_redirect/$', views.password_reset, {'post_reset_redirect': '/custom/'}),
+ url(r'^password_reset/custom_redirect/named/$', views.password_reset, {'post_reset_redirect': 'password_reset'}),
url(r'^password_reset/html_email_template/$', views.password_reset,
- dict(html_email_template_name='registration/html_password_reset_email.html')),
+ {'html_email_template_name': 'registration/html_password_reset_email.html'}),
url(r'^reset/custom/(?P
Name: