summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSimon Charette <charettes@users.noreply.github.com>2017-01-19 02:39:46 -0500
committerClaude Paroz <claude@2xlibre.net>2017-01-19 08:39:46 +0100
commitcecc079168e8669138728d31611ff3a1e7eb3a9f (patch)
tree2415083d44f84c6f206930fc689a8c0e50a98caa /tests
parenta5563963397aeee30c32e3c1dab31bfe453ca89f (diff)
Refs #23919 -- Stopped inheriting from object to define new style classes.
Diffstat (limited to 'tests')
-rw-r--r--tests/admin_docs/tests.py2
-rw-r--r--tests/admin_inlines/tests.py2
-rw-r--r--tests/admin_ordering/tests.py4
-rw-r--r--tests/admin_utils/tests.py6
-rw-r--r--tests/admin_views/test_multidb.py2
-rw-r--r--tests/admin_views/tests.py2
-rw-r--r--tests/admin_widgets/tests.py2
-rw-r--r--tests/apps/apps.py2
-rw-r--r--tests/apps/tests.py2
-rw-r--r--tests/auth_tests/models/custom_user.py2
-rw-r--r--tests/auth_tests/test_admin_multidb.py2
-rw-r--r--tests/auth_tests/test_auth_backends.py10
-rw-r--r--tests/auth_tests/test_auth_backends_deprecation.py2
-rw-r--r--tests/auth_tests/test_context_processors.py4
-rw-r--r--tests/auth_tests/test_decorators.py2
-rw-r--r--tests/auth_tests/test_forms.py2
-rw-r--r--tests/auth_tests/test_management.py4
-rw-r--r--tests/backends/tests.py4
-rw-r--r--tests/builtin_server/tests.py4
-rw-r--r--tests/cache/closeable_cache.py2
-rw-r--r--tests/cache/liberal_backend.py2
-rw-r--r--tests/cache/tests.py10
-rw-r--r--tests/check_framework/test_multi_db.py2
-rw-r--r--tests/check_framework/tests.py2
-rw-r--r--tests/contenttypes_tests/tests.py2
-rw-r--r--tests/csrf_tests/tests.py2
-rw-r--r--tests/custom_lookups/tests.py4
-rw-r--r--tests/custom_pk/fields.py2
-rw-r--r--tests/decorators/tests.py34
-rw-r--r--tests/defer/tests.py2
-rw-r--r--tests/deprecation/tests.py4
-rw-r--r--tests/dispatch/tests.py2
-rw-r--r--tests/files/tests.py2
-rw-r--r--tests/fixtures/tests.py2
-rw-r--r--tests/flatpages_tests/test_middleware.py2
-rw-r--r--tests/flatpages_tests/test_views.py2
-rw-r--r--tests/foreign_object/models/article.py2
-rw-r--r--tests/forms_tests/field_tests/__init__.py2
-rw-r--r--tests/forms_tests/field_tests/test_base.py2
-rw-r--r--tests/forms_tests/tests/test_error_messages.py2
-rw-r--r--tests/forms_tests/tests/test_renderers.py2
-rw-r--r--tests/forms_tests/widget_tests/test_clearablefileinput.py10
-rw-r--r--tests/generic_inline_admin/tests.py6
-rw-r--r--tests/generic_views/test_dates.py2
-rw-r--r--tests/generic_views/views.py6
-rw-r--r--tests/get_object_or_404/tests.py2
-rw-r--r--tests/gis_tests/gdal_tests/test_envelope.py2
-rw-r--r--tests/gis_tests/geo3d/tests.py2
-rw-r--r--tests/gis_tests/geos_tests/test_geos.py2
-rw-r--r--tests/gis_tests/layermap/tests.py2
-rw-r--r--tests/gis_tests/test_data.py6
-rw-r--r--tests/gis_tests/tests.py2
-rw-r--r--tests/handlers/tests_custom_error_handlers.py2
-rw-r--r--tests/i18n/utils.py4
-rw-r--r--tests/invalid_models_tests/test_models.py2
-rw-r--r--tests/invalid_models_tests/test_ordinary_fields.py4
-rw-r--r--tests/logging_tests/tests.py2
-rw-r--r--tests/mail/tests.py4
-rw-r--r--tests/messages_tests/base.py2
-rw-r--r--tests/messages_tests/test_api.py4
-rw-r--r--tests/middleware_exceptions/middleware.py2
-rw-r--r--tests/middleware_exceptions/tests.py4
-rw-r--r--tests/migrate_signals/tests.py4
-rw-r--r--tests/migrations/models.py2
-rw-r--r--tests/migrations/routers.py4
-rw-r--r--tests/migrations/test_autodetector.py2
-rw-r--r--tests/migrations/test_executor.py4
-rw-r--r--tests/migrations/test_multidb.py8
-rw-r--r--tests/migrations/test_operations.py2
-rw-r--r--tests/migrations/test_writer.py6
-rw-r--r--tests/model_forms/tests.py2
-rw-r--r--tests/model_formsets_regress/tests.py2
-rw-r--r--tests/model_inheritance/models.py2
-rw-r--r--tests/model_inheritance/test_abstract_inheritance.py4
-rw-r--r--tests/modeladmin/test_checks.py12
-rw-r--r--tests/modeladmin/tests.py6
-rw-r--r--tests/multiple_database/routers.py6
-rw-r--r--tests/multiple_database/tests.py14
-rw-r--r--tests/order_with_respect_to/base_tests.py2
-rw-r--r--tests/pagination/tests.py4
-rw-r--r--tests/postgres_tests/models.py2
-rw-r--r--tests/postgres_tests/test_search.py2
-rw-r--r--tests/queries/tests.py4
-rw-r--r--tests/queryset_pickle/models.py4
-rw-r--r--tests/serializers/models/base.py2
-rw-r--r--tests/serializers/test_yaml.py2
-rw-r--r--tests/serializers/tests.py6
-rw-r--r--tests/servers/test_basehttp.py2
-rw-r--r--tests/sessions_tests/tests.py2
-rw-r--r--tests/signals/tests.py4
-rw-r--r--tests/sites_tests/tests.py2
-rw-r--r--tests/staticfiles_tests/cases.py4
-rw-r--r--tests/staticfiles_tests/test_finders.py2
-rw-r--r--tests/staticfiles_tests/test_management.py2
-rw-r--r--tests/staticfiles_tests/test_storage.py2
-rw-r--r--tests/template_tests/filter_tests/test_floatformat.py2
-rw-r--r--tests/template_tests/filter_tests/test_unordered_list.py4
-rw-r--r--tests/template_tests/test_callables.py8
-rw-r--r--tests/template_tests/test_logging.py2
-rw-r--r--tests/template_tests/utils.py6
-rw-r--r--tests/test_client/auth_backends.py2
-rw-r--r--tests/test_client/views.py2
-rw-r--r--tests/test_client_regress/tests.py4
-rw-r--r--tests/test_runner/tests.py2
-rw-r--r--tests/transactions/tests.py2
-rw-r--r--tests/urlpatterns_reverse/method_view_urls.py2
-rw-r--r--tests/urlpatterns_reverse/tests.py2
-rw-r--r--tests/urlpatterns_reverse/utils.py2
-rw-r--r--tests/urlpatterns_reverse/views.py2
-rw-r--r--tests/utils_tests/test_archive.py2
-rw-r--r--tests/utils_tests/test_decorators.py12
-rw-r--r--tests/utils_tests/test_encoding.py2
-rw-r--r--tests/utils_tests/test_functional.py8
-rw-r--r--tests/utils_tests/test_html.py8
-rw-r--r--tests/utils_tests/test_inspect.py2
-rw-r--r--tests/utils_tests/test_lazyobject.py6
-rw-r--r--tests/utils_tests/test_module/__init__.py2
-rw-r--r--tests/utils_tests/test_module_loading.py6
-rw-r--r--tests/utils_tests/test_safestring.py2
-rw-r--r--tests/view_tests/tests/test_debug.py14
-rw-r--r--tests/view_tests/views.py2
-rw-r--r--tests/wsgi/tests.py2
122 files changed, 229 insertions, 229 deletions
diff --git a/tests/admin_docs/tests.py b/tests/admin_docs/tests.py
index 2a2f9d25e0..dfe6104a33 100644
--- a/tests/admin_docs/tests.py
+++ b/tests/admin_docs/tests.py
@@ -2,7 +2,7 @@ from django.contrib.auth.models import User
from django.test import TestCase, modify_settings, override_settings
-class TestDataMixin(object):
+class TestDataMixin:
@classmethod
def setUpTestData(cls):
diff --git a/tests/admin_inlines/tests.py b/tests/admin_inlines/tests.py
index 6deba9b1c2..20fa9c0241 100644
--- a/tests/admin_inlines/tests.py
+++ b/tests/admin_inlines/tests.py
@@ -18,7 +18,7 @@ from .models import (
INLINE_CHANGELINK_HTML = 'class="inlinechangelink">Change</a>'
-class TestDataMixin(object):
+class TestDataMixin:
@classmethod
def setUpTestData(cls):
diff --git a/tests/admin_ordering/tests.py b/tests/admin_ordering/tests.py
index 250b59dea8..77597d0fb5 100644
--- a/tests/admin_ordering/tests.py
+++ b/tests/admin_ordering/tests.py
@@ -9,11 +9,11 @@ from .models import (
)
-class MockRequest(object):
+class MockRequest:
pass
-class MockSuperUser(object):
+class MockSuperUser:
def has_perm(self, perm):
return True
diff --git a/tests/admin_utils/tests.py b/tests/admin_utils/tests.py
index 245334df4d..1c14615e71 100644
--- a/tests/admin_utils/tests.py
+++ b/tests/admin_utils/tests.py
@@ -105,7 +105,7 @@ class UtilsTests(SimpleTestCase):
SIMPLE_FUNCTION = 'function'
INSTANCE_ATTRIBUTE = 'attr'
- class MockModelAdmin(object):
+ class MockModelAdmin:
def get_admin_value(self, obj):
return ADMIN_METHOD
@@ -259,7 +259,7 @@ class UtilsTests(SimpleTestCase):
)
self.assertEqual(label_for_field('site_id', Article), 'Site id')
- class MockModelAdmin(object):
+ class MockModelAdmin:
def test_from_model(self, obj):
return "nothing"
test_from_model.short_description = "not Really the Model"
@@ -276,7 +276,7 @@ class UtilsTests(SimpleTestCase):
def test_label_for_property(self):
# NOTE: cannot use @property decorator, because of
# AttributeError: 'property' object has no attribute 'short_description'
- class MockModelAdmin(object):
+ class MockModelAdmin:
def my_property(self):
return "this if from property"
my_property.short_description = 'property short description'
diff --git a/tests/admin_views/test_multidb.py b/tests/admin_views/test_multidb.py
index 102cf35a5d..0273b7aaef 100644
--- a/tests/admin_views/test_multidb.py
+++ b/tests/admin_views/test_multidb.py
@@ -8,7 +8,7 @@ from django.urls import reverse
from .models import Book
-class Router(object):
+class Router:
target_db = None
def db_for_read(self, model, **hints):
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
index 81b7e1f6a4..ae3ebdd54d 100644
--- a/tests/admin_views/tests.py
+++ b/tests/admin_views/tests.py
@@ -65,7 +65,7 @@ ERROR_MESSAGE = "Please enter the correct username and password \
for a staff account. Note that both fields may be case-sensitive."
-class AdminFieldExtractionMixin(object):
+class AdminFieldExtractionMixin:
"""
Helper methods for extracting data from AdminForm.
"""
diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py
index ae8443565d..b9462498cc 100644
--- a/tests/admin_widgets/tests.py
+++ b/tests/admin_widgets/tests.py
@@ -26,7 +26,7 @@ from .models import (
from .widgetadmin import site as widget_admin_site
-class TestDataMixin(object):
+class TestDataMixin:
@classmethod
def setUpTestData(cls):
diff --git a/tests/apps/apps.py b/tests/apps/apps.py
index 1096c1e4b8..d322b28f2b 100644
--- a/tests/apps/apps.py
+++ b/tests/apps/apps.py
@@ -16,7 +16,7 @@ class BadConfig(AppConfig):
"""This class doesn't supply the mandatory 'name' attribute."""
-class NotAConfig(object):
+class NotAConfig:
name = 'apps'
diff --git a/tests/apps/tests.py b/tests/apps/tests.py
index 9576420b54..e270662436 100644
--- a/tests/apps/tests.py
+++ b/tests/apps/tests.py
@@ -296,7 +296,7 @@ class AppsTests(SimpleTestCase):
self.assertListEqual(model_classes, [LazyA, LazyB, LazyB, LazyC, LazyA])
-class Stub(object):
+class Stub:
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
diff --git a/tests/auth_tests/models/custom_user.py b/tests/auth_tests/models/custom_user.py
index 049ae85e5c..60fcc494c4 100644
--- a/tests/auth_tests/models/custom_user.py
+++ b/tests/auth_tests/models/custom_user.py
@@ -74,7 +74,7 @@ class CustomUser(AbstractBaseUser):
return self.is_admin
-class RemoveGroupsAndPermissions(object):
+class RemoveGroupsAndPermissions:
"""
A context manager to temporarily remove the groups and user_permissions M2M
fields from the AbstractUser class, so they don't clash with the
diff --git a/tests/auth_tests/test_admin_multidb.py b/tests/auth_tests/test_admin_multidb.py
index 9d0d999739..122cb78876 100644
--- a/tests/auth_tests/test_admin_multidb.py
+++ b/tests/auth_tests/test_admin_multidb.py
@@ -7,7 +7,7 @@ from django.test import TestCase, mock, override_settings
from django.urls import reverse
-class Router(object):
+class Router:
target_db = None
def db_for_read(self, model, **hints):
diff --git a/tests/auth_tests/test_auth_backends.py b/tests/auth_tests/test_auth_backends.py
index f06e825698..033df9c682 100644
--- a/tests/auth_tests/test_auth_backends.py
+++ b/tests/auth_tests/test_auth_backends.py
@@ -29,7 +29,7 @@ class CountingMD5PasswordHasher(MD5PasswordHasher):
return super(CountingMD5PasswordHasher, self).encode(*args, **kwargs)
-class BaseModelBackendTest(object):
+class BaseModelBackendTest:
"""
A base class for tests that need to validate the ModelBackend
with different User models. Subclasses should define a class
@@ -319,11 +319,11 @@ class UUIDUserTests(TestCase):
self.assertEqual(UUIDUser.objects.get(pk=self.client.session[SESSION_KEY]), user)
-class TestObj(object):
+class TestObj:
pass
-class SimpleRowlevelBackend(object):
+class SimpleRowlevelBackend:
def has_perm(self, user, perm, obj=None):
if not obj:
return # We only support row level perms
@@ -468,7 +468,7 @@ class InActiveUserBackendTest(TestCase):
self.assertIs(self.user1.has_module_perms("app2"), False)
-class PermissionDeniedBackend(object):
+class PermissionDeniedBackend:
"""
Always raises PermissionDenied in `authenticate`, `has_perm` and `has_module_perms`.
"""
@@ -573,7 +573,7 @@ class ChangedBackendSettingsTest(TestCase):
self.assertTrue(user.is_anonymous)
-class TypeErrorBackend(object):
+class TypeErrorBackend:
"""
Always raises TypeError.
"""
diff --git a/tests/auth_tests/test_auth_backends_deprecation.py b/tests/auth_tests/test_auth_backends_deprecation.py
index 6178936535..fc39d0be22 100644
--- a/tests/auth_tests/test_auth_backends_deprecation.py
+++ b/tests/auth_tests/test_auth_backends_deprecation.py
@@ -4,7 +4,7 @@ from django.contrib.auth import authenticate
from django.test import SimpleTestCase, override_settings
-class NoRequestBackend(object):
+class NoRequestBackend:
def authenticate(self, username=None, password=None):
# Doesn't accept a request parameter.
pass
diff --git a/tests/auth_tests/test_context_processors.py b/tests/auth_tests/test_context_processors.py
index 3857917860..d66b28cb9c 100644
--- a/tests/auth_tests/test_context_processors.py
+++ b/tests/auth_tests/test_context_processors.py
@@ -8,7 +8,7 @@ from django.test import SimpleTestCase, TestCase, override_settings
from .settings import AUTH_MIDDLEWARE, AUTH_TEMPLATES
-class MockUser(object):
+class MockUser:
def has_module_perms(self, perm):
if perm == 'mockapp':
return True
@@ -24,7 +24,7 @@ class PermWrapperTests(SimpleTestCase):
"""
Test some details of the PermWrapper implementation.
"""
- class EQLimiterObject(object):
+ class EQLimiterObject:
"""
This object makes sure __eq__ will not be called endlessly.
"""
diff --git a/tests/auth_tests/test_decorators.py b/tests/auth_tests/test_decorators.py
index dc3482de22..55c422bdc6 100644
--- a/tests/auth_tests/test_decorators.py
+++ b/tests/auth_tests/test_decorators.py
@@ -19,7 +19,7 @@ class LoginRequiredTestCase(AuthViewsTestCase):
"""
login_required is assignable to callable objects.
"""
- class CallableView(object):
+ class CallableView:
def __call__(self, *args, **kwargs):
pass
login_required(CallableView())
diff --git a/tests/auth_tests/test_forms.py b/tests/auth_tests/test_forms.py
index c055b58042..ae6fa313de 100644
--- a/tests/auth_tests/test_forms.py
+++ b/tests/auth_tests/test_forms.py
@@ -27,7 +27,7 @@ from .models.with_integer_username import IntegerUsernameUser
from .settings import AUTH_TEMPLATES
-class TestDataMixin(object):
+class TestDataMixin:
@classmethod
def setUpTestData(cls):
diff --git a/tests/auth_tests/test_management.py b/tests/auth_tests/test_management.py
index 4fd1563f84..12d029ffcd 100644
--- a/tests/auth_tests/test_management.py
+++ b/tests/auth_tests/test_management.py
@@ -62,7 +62,7 @@ def mock_inputs(inputs):
return inner
-class MockTTY(object):
+class MockTTY:
"""
A fake stdin object that pretends to be a TTY to be used in conjunction
with mock_inputs.
@@ -329,7 +329,7 @@ class CreatesuperuserManagementCommandTestCase(TestCase):
If the command is not called from a TTY, it should be skipped and a
message should be displayed (#7423).
"""
- class FakeStdin(object):
+ class FakeStdin:
"""A fake stdin object that has isatty() return False."""
def isatty(self):
return False
diff --git a/tests/backends/tests.py b/tests/backends/tests.py
index 89afb20760..662cdc4140 100644
--- a/tests/backends/tests.py
+++ b/tests/backends/tests.py
@@ -234,7 +234,7 @@ class PostgreSQLTests(TestCase):
"""Test PostgreSQL version detection"""
# Helper mocks
- class CursorMock(object):
+ class CursorMock:
"Very simple mock of DB-API cursor"
def execute(self, arg):
pass
@@ -248,7 +248,7 @@ class PostgreSQLTests(TestCase):
def __exit__(self, type, value, traceback):
pass
- class OlderConnectionMock(object):
+ class OlderConnectionMock:
"Mock of psycopg2 (< 2.0.12) connection"
def cursor(self):
return CursorMock()
diff --git a/tests/builtin_server/tests.py b/tests/builtin_server/tests.py
index 2784571b0c..6e234c1ba4 100644
--- a/tests/builtin_server/tests.py
+++ b/tests/builtin_server/tests.py
@@ -9,7 +9,7 @@ from wsgiref import simple_server
MAX_SOCKET_CHUNK_SIZE = 32 * 1024 * 1024 # 32 MB
-class ServerHandler(simple_server.ServerHandler, object):
+class ServerHandler(simple_server.ServerHandler):
error_status = str("500 INTERNAL SERVER ERROR")
def write(self, data):
@@ -38,7 +38,7 @@ class ServerHandler(simple_server.ServerHandler, object):
return ['\n'.join(traceback.format_exception(*sys.exc_info()))]
-class DummyHandler(object):
+class DummyHandler:
def log_request(self, *args, **kwargs):
pass
diff --git a/tests/cache/closeable_cache.py b/tests/cache/closeable_cache.py
index 1ac868dde9..a9e99a62cd 100644
--- a/tests/cache/closeable_cache.py
+++ b/tests/cache/closeable_cache.py
@@ -1,7 +1,7 @@
from django.core.cache.backends.locmem import LocMemCache
-class CloseHookMixin(object):
+class CloseHookMixin:
closed = False
def close(self, **kwargs):
diff --git a/tests/cache/liberal_backend.py b/tests/cache/liberal_backend.py
index 339066b0ff..93dc39a0d7 100644
--- a/tests/cache/liberal_backend.py
+++ b/tests/cache/liberal_backend.py
@@ -1,7 +1,7 @@
from django.core.cache.backends.locmem import LocMemCache
-class LiberalKeyValidationMixin(object):
+class LiberalKeyValidationMixin:
def validate_key(self, key):
pass
diff --git a/tests/cache/tests.py b/tests/cache/tests.py
index dd886cd11b..bfceff9b02 100644
--- a/tests/cache/tests.py
+++ b/tests/cache/tests.py
@@ -56,12 +56,12 @@ class C:
return 24
-class Unpicklable(object):
+class Unpicklable:
def __getstate__(self):
raise pickle.PickleError()
-class UnpicklableType(object):
+class UnpicklableType:
# Unpicklable using the default pickling protocol on Python 2.
__slots__ = 'a',
@@ -251,7 +251,7 @@ def caches_setting_for_tests(base=None, exclude=None, **params):
return setting
-class BaseCacheTests(object):
+class BaseCacheTests:
# A common set of tests to apply to all cache backends
def setUp(self):
@@ -1010,7 +1010,7 @@ class DBCacheWithTimeZoneTests(DBCacheTests):
pass
-class DBCacheRouter(object):
+class DBCacheRouter:
"""A router that puts the cache table on the 'other' database."""
def db_for_read(self, model, **hints):
@@ -1061,7 +1061,7 @@ class CreateCacheTableForDBCacheTests(TestCase):
verbosity=0, interactive=False)
-class PicklingSideEffect(object):
+class PicklingSideEffect:
def __init__(self, cache):
self.cache = cache
diff --git a/tests/check_framework/test_multi_db.py b/tests/check_framework/test_multi_db.py
index f273d397e2..700553f47b 100644
--- a/tests/check_framework/test_multi_db.py
+++ b/tests/check_framework/test_multi_db.py
@@ -3,7 +3,7 @@ from django.test import TestCase, mock
from django.test.utils import isolate_apps, override_settings
-class TestRouter(object):
+class TestRouter:
"""
Routes to the 'other' database if the model name starts with 'Other'.
"""
diff --git a/tests/check_framework/tests.py b/tests/check_framework/tests.py
index 30e1353dc0..46e4095a38 100644
--- a/tests/check_framework/tests.py
+++ b/tests/check_framework/tests.py
@@ -17,7 +17,7 @@ from django.utils.encoding import force_text
from .models import SimpleModel, my_check
-class DummyObj(object):
+class DummyObj:
def __repr__(self):
return "obj"
diff --git a/tests/contenttypes_tests/tests.py b/tests/contenttypes_tests/tests.py
index c91c265eaf..0ae2ddbb64 100644
--- a/tests/contenttypes_tests/tests.py
+++ b/tests/contenttypes_tests/tests.py
@@ -432,7 +432,7 @@ class UpdateContentTypesTests(TestCase):
self.assertEqual(ContentType.objects.count(), self.before_count + 1)
-class TestRouter(object):
+class TestRouter:
def db_for_read(self, model, **hints):
return 'other'
diff --git a/tests/csrf_tests/tests.py b/tests/csrf_tests/tests.py
index 49247b7af8..f68b0f037b 100644
--- a/tests/csrf_tests/tests.py
+++ b/tests/csrf_tests/tests.py
@@ -35,7 +35,7 @@ class TestingHttpRequest(HttpRequest):
return getattr(self, '_is_secure_override', False)
-class CsrfViewMiddlewareTestMixin(object):
+class CsrfViewMiddlewareTestMixin:
"""
Shared methods and tests for session-based and cookie-based tokens.
"""
diff --git a/tests/custom_lookups/tests.py b/tests/custom_lookups/tests.py
index e66a280e16..7b8cca6646 100644
--- a/tests/custom_lookups/tests.py
+++ b/tests/custom_lookups/tests.py
@@ -134,7 +134,7 @@ class Exactly(models.lookups.Exact):
return connection.operators['exact'] % rhs
-class SQLFuncMixin(object):
+class SQLFuncMixin:
def as_sql(self, compiler, connection):
return '%s()', [self.name]
@@ -155,7 +155,7 @@ class SQLFuncTransform(SQLFuncMixin, models.Transform):
self.name = name
-class SQLFuncFactory(object):
+class SQLFuncFactory:
def __init__(self, key, name):
self.key = key
diff --git a/tests/custom_pk/fields.py b/tests/custom_pk/fields.py
index fa61a72a0d..2be2288ed8 100644
--- a/tests/custom_pk/fields.py
+++ b/tests/custom_pk/fields.py
@@ -4,7 +4,7 @@ import string
from django.db import models
-class MyWrapper(object):
+class MyWrapper:
def __init__(self, value):
self.value = value
diff --git a/tests/decorators/tests.py b/tests/decorators/tests.py
index 851c2b8daa..c2116a05ce 100644
--- a/tests/decorators/tests.py
+++ b/tests/decorators/tests.py
@@ -109,10 +109,10 @@ class DecoratorsTest(TestCase):
callback = user_passes_test(test1)(callback)
callback = user_passes_test(test2)(callback)
- class DummyUser(object):
+ class DummyUser:
pass
- class DummyRequest(object):
+ class DummyRequest:
pass
request = DummyRequest()
@@ -184,7 +184,7 @@ def myattr2_dec(func):
myattr2_dec_m = method_decorator(myattr2_dec)
-class ClsDec(object):
+class ClsDec:
def __init__(self, myattr):
self.myattr = myattr
@@ -200,7 +200,7 @@ class MethodDecoratorTests(SimpleTestCase):
Tests for method_decorator
"""
def test_preserve_signature(self):
- class Test(object):
+ class Test:
@simple_dec_m
def say(self, arg):
return arg
@@ -218,7 +218,7 @@ class MethodDecoratorTests(SimpleTestCase):
self.assertIs(getattr(func, 'myattr2', False), True)
# Decorate using method_decorator() on the method.
- class TestPlain(object):
+ class TestPlain:
@myattr_dec_m
@myattr2_dec_m
def method(self):
@@ -229,7 +229,7 @@ class MethodDecoratorTests(SimpleTestCase):
# The decorators applied to the methods are applied before the ones
# applied to the class.
@method_decorator(myattr_dec_m, "method")
- class TestMethodAndClass(object):
+ class TestMethodAndClass:
@method_decorator(myattr2_dec_m)
def method(self):
"A method"
@@ -239,7 +239,7 @@ class MethodDecoratorTests(SimpleTestCase):
decorators = (myattr_dec_m, myattr2_dec_m)
@method_decorator(decorators, "method")
- class TestIterable(object):
+ class TestIterable:
def method(self):
"A method"
pass
@@ -259,14 +259,14 @@ class MethodDecoratorTests(SimpleTestCase):
# The rest of the exception message differs between Python 2 and 3.
with self.assertRaisesMessage(TypeError, "'set' object"):
@method_decorator(decorators, "method")
- class TestIterable(object):
+ class TestIterable:
def method(self):
"A method"
pass
# Test for argumented decorator
def test_argumented(self):
- class Test(object):
+ class Test:
@method_decorator(ClsDec(False))
def method(self):
return True
@@ -283,7 +283,7 @@ class MethodDecoratorTests(SimpleTestCase):
method_dec = method_decorator(original_dec)
- class bound_wrapper(object):
+ class bound_wrapper:
def __init__(self, wrapped):
self.wrapped = wrapped
self.__name__ = wrapped.__name__
@@ -294,7 +294,7 @@ class MethodDecoratorTests(SimpleTestCase):
def __get__(self, instance, cls=None):
return self
- class descriptor_wrapper(object):
+ class descriptor_wrapper:
def __init__(self, wrapped):
self.wrapped = wrapped
self.__name__ = wrapped.__name__
@@ -302,7 +302,7 @@ class MethodDecoratorTests(SimpleTestCase):
def __get__(self, instance, cls=None):
return bound_wrapper(self.wrapped.__get__(instance, cls))
- class Test(object):
+ class Test:
@method_dec
@descriptor_wrapper
def method(self, arg):
@@ -320,7 +320,7 @@ class MethodDecoratorTests(SimpleTestCase):
return _wrapper
@method_decorator(deco, name="method")
- class Test(object):
+ class Test:
def method(self):
return False
@@ -349,11 +349,11 @@ class MethodDecoratorTests(SimpleTestCase):
decorators = (add_exclamation_mark, add_question_mark)
@method_decorator(decorators, name="method")
- class TestFirst(object):
+ class TestFirst:
def method(self):
return "hello world"
- class TestSecond(object):
+ class TestSecond:
@method_decorator(decorators)
def method(self):
return "hello world"
@@ -371,7 +371,7 @@ class MethodDecoratorTests(SimpleTestCase):
)
with self.assertRaisesMessage(TypeError, msg):
@method_decorator(lambda: None, name="prop")
- class Test(object):
+ class Test:
prop = 1
@classmethod
@@ -388,7 +388,7 @@ class MethodDecoratorTests(SimpleTestCase):
)
with self.assertRaisesMessage(ValueError, msg):
@method_decorator(lambda: None, name="non_existing_method")
- class Test(object):
+ class Test:
@classmethod
def __module__(cls):
return "tests"
diff --git a/tests/defer/tests.py b/tests/defer/tests.py
index 0eea9545dd..6badd7056e 100644
--- a/tests/defer/tests.py
+++ b/tests/defer/tests.py
@@ -6,7 +6,7 @@ from .models import (
)
-class AssertionMixin(object):
+class AssertionMixin:
def assert_delayed(self, obj, num):
"""
Instances with deferred fields look the same as normal instances when
diff --git a/tests/deprecation/tests.py b/tests/deprecation/tests.py
index 5c2361f7a0..220010d909 100644
--- a/tests/deprecation/tests.py
+++ b/tests/deprecation/tests.py
@@ -140,11 +140,11 @@ class RenameMethodsTests(SimpleTestCase):
def new(self):
pass
- class RenamedMixin(object):
+ class RenamedMixin:
def new(self):
super(RenamedMixin, self).new()
- class DeprecatedMixin(object):
+ class DeprecatedMixin:
def old(self):
super(DeprecatedMixin, self).old()
diff --git a/tests/dispatch/tests.py b/tests/dispatch/tests.py
index d36dde9720..04fb39454d 100644
--- a/tests/dispatch/tests.py
+++ b/tests/dispatch/tests.py
@@ -29,7 +29,7 @@ def receiver_1_arg(val, **kwargs):
return val
-class Callable(object):
+class Callable:
def __call__(self, val, **kwargs):
return val
diff --git a/tests/files/tests.py b/tests/files/tests.py
index 50db4b7436..4515b1cab1 100644
--- a/tests/files/tests.py
+++ b/tests/files/tests.py
@@ -209,7 +209,7 @@ class DimensionClosingBug(unittest.TestCase):
# get_image_dimensions will call our catching_open instead of the
# regular builtin one.
- class FileWrapper(object):
+ class FileWrapper:
_closed = []
def __init__(self, f):
diff --git a/tests/fixtures/tests.py b/tests/fixtures/tests.py
index 51d8eef51b..ca60dd70e8 100644
--- a/tests/fixtures/tests.py
+++ b/tests/fixtures/tests.py
@@ -47,7 +47,7 @@ class SubclassTestCaseFixtureLoadingTests(TestCaseFixtureLoadingTests):
self.assertEqual(Article.objects.count(), 0)
-class DumpDataAssertMixin(object):
+class DumpDataAssertMixin:
def _dumpdata_assert(self, args, output, format='json', filename=None,
natural_foreign_keys=False, natural_primary_keys=False,
diff --git a/tests/flatpages_tests/test_middleware.py b/tests/flatpages_tests/test_middleware.py
index dd1d9e02f7..b7ca196db1 100644
--- a/tests/flatpages_tests/test_middleware.py
+++ b/tests/flatpages_tests/test_middleware.py
@@ -7,7 +7,7 @@ from django.test import TestCase, modify_settings, override_settings
from .settings import FLATPAGES_TEMPLATES
-class TestDataMixin(object):
+class TestDataMixin:
@classmethod
def setUpTestData(cls):
diff --git a/tests/flatpages_tests/test_views.py b/tests/flatpages_tests/test_views.py
index a5104ce620..42d3e2e8cc 100644
--- a/tests/flatpages_tests/test_views.py
+++ b/tests/flatpages_tests/test_views.py
@@ -7,7 +7,7 @@ from django.test import TestCase, modify_settings, override_settings
from .settings import FLATPAGES_TEMPLATES
-class TestDataMixin(object):
+class TestDataMixin:
@classmethod
def setUpTestData(cls):
diff --git a/tests/foreign_object/models/article.py b/tests/foreign_object/models/article.py
index e5c0c1f673..940ec003fb 100644
--- a/tests/foreign_object/models/article.py
+++ b/tests/foreign_object/models/article.py
@@ -15,7 +15,7 @@ class ArticleTranslationDescriptor(ForwardManyToOneDescriptor):
setattr(value, self.field.related.get_cache_name(), instance)
-class ColConstraint(object):
+class ColConstraint:
# Anything with as_sql() method works in get_extra_restriction().
def __init__(self, alias, col, value):
self.alias, self.col, self.value = alias, col, value
diff --git a/tests/forms_tests/field_tests/__init__.py b/tests/forms_tests/field_tests/__init__.py
index b984c6fb40..4aae30282b 100644
--- a/tests/forms_tests/field_tests/__init__.py
+++ b/tests/forms_tests/field_tests/__init__.py
@@ -1,7 +1,7 @@
from django import forms
-class FormFieldAssertionsMixin(object):
+class FormFieldAssertionsMixin:
def assertWidgetRendersTo(self, field, to):
class Form(forms.Form):
diff --git a/tests/forms_tests/field_tests/test_base.py b/tests/forms_tests/field_tests/test_base.py
index 67c3003393..721c0a935a 100644
--- a/tests/forms_tests/field_tests/test_base.py
+++ b/tests/forms_tests/field_tests/test_base.py
@@ -9,7 +9,7 @@ class BasicFieldsTests(SimpleTestCase):
self.assertFalse(Field(required=False).widget.is_required)
def test_cooperative_multiple_inheritance(self):
- class A(object):
+ class A:
def __init__(self):
self.class_a_var = True
super(A, self).__init__()
diff --git a/tests/forms_tests/tests/test_error_messages.py b/tests/forms_tests/tests/test_error_messages.py
index 10c7a92f7d..40b085f55b 100644
--- a/tests/forms_tests/tests/test_error_messages.py
+++ b/tests/forms_tests/tests/test_error_messages.py
@@ -13,7 +13,7 @@ from django.utils.safestring import mark_safe
from ..models import ChoiceModel
-class AssertFormErrorsMixin(object):
+class AssertFormErrorsMixin:
def assertFormErrors(self, expected, the_callable, *args, **kwargs):
with self.assertRaises(ValidationError) as cm:
the_callable(*args, **kwargs)
diff --git a/tests/forms_tests/tests/test_renderers.py b/tests/forms_tests/tests/test_renderers.py
index 2ce6be66af..df9c9cf367 100644
--- a/tests/forms_tests/tests/test_renderers.py
+++ b/tests/forms_tests/tests/test_renderers.py
@@ -13,7 +13,7 @@ except ImportError:
jinja2 = None
-class SharedTests(object):
+class SharedTests:
expected_widget_dir = 'templates'
def test_installed_apps_template_found(self):
diff --git a/tests/forms_tests/widget_tests/test_clearablefileinput.py b/tests/forms_tests/widget_tests/test_clearablefileinput.py
index dd7f04d0ac..eea7054541 100644
--- a/tests/forms_tests/widget_tests/test_clearablefileinput.py
+++ b/tests/forms_tests/widget_tests/test_clearablefileinput.py
@@ -4,7 +4,7 @@ from django.forms import ClearableFileInput
from .base import WidgetTest
-class FakeFieldFile(object):
+class FakeFieldFile:
"""
Quacks like a FieldFile (has a .url and unicode representation), but
doesn't require us to care about storages etc.
@@ -37,7 +37,7 @@ class ClearableFileInputTest(WidgetTest):
A ClearableFileInput should escape name, filename, and URL
when rendering HTML (#15182).
"""
- class StrangeFieldFile(object):
+ class StrangeFieldFile:
url = "something?chapter=1&sect=2&copy=3&lang=en"
def __str__(self):
@@ -107,7 +107,7 @@ class ClearableFileInputTest(WidgetTest):
A ClearableFileInput should not mask exceptions produced while
checking that it has a value.
"""
- class FailingURLFieldFile(object):
+ class FailingURLFieldFile:
@property
def url(self):
raise ValueError('Canary')
@@ -119,7 +119,7 @@ class ClearableFileInputTest(WidgetTest):
self.widget.render('myfile', FailingURLFieldFile())
def test_url_as_property(self):
- class URLFieldFile(object):
+ class URLFieldFile:
@property
def url(self):
return 'https://www.python.org/'
@@ -131,7 +131,7 @@ class ClearableFileInputTest(WidgetTest):
self.assertInHTML('<a href="https://www.python.org/">value</a>', html)
def test_return_false_if_url_does_not_exists(self):
- class NoURLFieldFile(object):
+ class NoURLFieldFile:
def __str__(self):
return 'value'
diff --git a/tests/generic_inline_admin/tests.py b/tests/generic_inline_admin/tests.py
index 203d9d7f3e..26a53f9985 100644
--- a/tests/generic_inline_admin/tests.py
+++ b/tests/generic_inline_admin/tests.py
@@ -15,7 +15,7 @@ from .admin import MediaInline, MediaPermanentInline, site as admin_site
from .models import Category, Episode, EpisodePermanent, Media, PhoneNumber
-class TestDataMixin(object):
+class TestDataMixin:
@classmethod
def setUpTestData(cls):
@@ -386,11 +386,11 @@ class NoInlineDeletionTest(SimpleTestCase):
self.assertFalse(formset.can_delete)
-class MockRequest(object):
+class MockRequest:
pass
-class MockSuperUser(object):
+class MockSuperUser:
def has_perm(self, perm):
return True
diff --git a/tests/generic_views/test_dates.py b/tests/generic_views/test_dates.py
index d18c818989..bf462b44fb 100644
--- a/tests/generic_views/test_dates.py
+++ b/tests/generic_views/test_dates.py
@@ -17,7 +17,7 @@ def _make_books(n, base_date):
pubdate=base_date - datetime.timedelta(days=i))
-class TestDataMixin(object):
+class TestDataMixin:
@classmethod
def setUpTestData(cls):
diff --git a/tests/generic_views/views.py b/tests/generic_views/views.py
index b466f3a324..05d5ec2f00 100644
--- a/tests/generic_views/views.py
+++ b/tests/generic_views/views.py
@@ -189,7 +189,7 @@ class SpecializedAuthorDelete(generic.DeleteView):
success_url = reverse_lazy('authors_list')
-class BookConfig(object):
+class BookConfig:
queryset = Book.objects.all()
date_field = 'pubdate'
@@ -266,7 +266,7 @@ class CustomSingleObjectView(generic.detail.SingleObjectMixin, generic.View):
object = Book(name="dummy")
-class BookSigningConfig(object):
+class BookSigningConfig:
model = BookSigning
date_field = 'event_date'
# use the same templates as for books
@@ -303,7 +303,7 @@ class BookSigningDetail(BookSigningConfig, generic.DateDetailView):
context_object_name = 'book'
-class NonModel(object):
+class NonModel:
id = "non_model_1"
_meta = None
diff --git a/tests/get_object_or_404/tests.py b/tests/get_object_or_404/tests.py
index b5a233568d..fa3c0cb324 100644
--- a/tests/get_object_or_404/tests.py
+++ b/tests/get_object_or_404/tests.py
@@ -83,7 +83,7 @@ class GetObjectOr404Tests(TestCase):
with self.assertRaisesMessage(ValueError, msg):
get_object_or_404(str("Article"), title__icontains="Run")
- class CustomClass(object):
+ class CustomClass:
pass
msg = "First argument to get_object_or_404() must be a Model, Manager, or QuerySet, not 'CustomClass'."
diff --git a/tests/gis_tests/gdal_tests/test_envelope.py b/tests/gis_tests/gdal_tests/test_envelope.py
index 8ea06ff426..b6cf4ab4f3 100644
--- a/tests/gis_tests/gdal_tests/test_envelope.py
+++ b/tests/gis_tests/gdal_tests/test_envelope.py
@@ -7,7 +7,7 @@ if HAS_GDAL:
from django.contrib.gis.gdal import Envelope, GDALException
-class TestPoint(object):
+class TestPoint:
def __init__(self, x, y):
self.x = x
self.y = y
diff --git a/tests/gis_tests/geo3d/tests.py b/tests/gis_tests/geo3d/tests.py
index e32611934a..72be664014 100644
--- a/tests/gis_tests/geo3d/tests.py
+++ b/tests/gis_tests/geo3d/tests.py
@@ -66,7 +66,7 @@ bbox_data = (
)
-class Geo3DLoadingHelper(object):
+class Geo3DLoadingHelper:
def _load_interstate_data(self):
# Interstate (2D / 3D and Geographic/Projected variants)
for name, line, exp_z in interstate_data:
diff --git a/tests/gis_tests/geos_tests/test_geos.py b/tests/gis_tests/geos_tests/test_geos.py
index f7024e790e..8626c4f200 100644
--- a/tests/gis_tests/geos_tests/test_geos.py
+++ b/tests/gis_tests/geos_tests/test_geos.py
@@ -89,7 +89,7 @@ class GEOSTest(SimpleTestCase, TestDataMixin):
with self.assertRaises(GEOSException):
GEOSGeometry(memoryview(b'0'))
- class NotAGeometry(object):
+ class NotAGeometry:
pass
# Some other object
diff --git a/tests/gis_tests/layermap/tests.py b/tests/gis_tests/layermap/tests.py
index 0f59132b0d..ce4b0c90d5 100644
--- a/tests/gis_tests/layermap/tests.py
+++ b/tests/gis_tests/layermap/tests.py
@@ -318,7 +318,7 @@ class LayerMapTest(TestCase):
self.assertEqual(City.objects.all()[0].name, "Zürich")
-class OtherRouter(object):
+class OtherRouter:
def db_for_read(self, model, **hints):
return 'other'
diff --git a/tests/gis_tests/test_data.py b/tests/gis_tests/test_data.py
index 9e31b5a599..23df42c007 100644
--- a/tests/gis_tests/test_data.py
+++ b/tests/gis_tests/test_data.py
@@ -31,7 +31,7 @@ def get_ds_file(name, ext):
)
-class TestObj(object):
+class TestObj:
"""
Base testing object, turns keyword args into attributes.
"""
@@ -76,7 +76,7 @@ class TestGeom(TestObj):
super(TestGeom, self).__init__(**kwargs)
-class TestGeomSet(object):
+class TestGeomSet:
"""
Each attribute of this object is a list of `TestGeom` instances.
"""
@@ -85,7 +85,7 @@ class TestGeomSet(object):
setattr(self, key, [TestGeom(**strconvert(kw)) for kw in value])
-class TestDataMixin(object):
+class TestDataMixin:
"""
Mixin used for GEOS/GDAL test cases that defines a `geometries`
property, which returns and/or loads the reference geometry data.
diff --git a/tests/gis_tests/tests.py b/tests/gis_tests/tests.py
index 59b8fcf7b5..6b689cf9b0 100644
--- a/tests/gis_tests/tests.py
+++ b/tests/gis_tests/tests.py
@@ -23,7 +23,7 @@ except ImproperlyConfigured as e:
if HAS_POSTGRES:
- class FakeConnection(object):
+ class FakeConnection:
def __init__(self):
self.settings_dict = {
'NAME': 'test',
diff --git a/tests/handlers/tests_custom_error_handlers.py b/tests/handlers/tests_custom_error_handlers.py
index 04f58fbe2a..3821783f79 100644
--- a/tests/handlers/tests_custom_error_handlers.py
+++ b/tests/handlers/tests_custom_error_handlers.py
@@ -4,7 +4,7 @@ from django.template.response import TemplateResponse
from django.test import SimpleTestCase, modify_settings, override_settings
-class MiddlewareAccessingContent(object):
+class MiddlewareAccessingContent:
def __init__(self, get_response):
self.get_response = get_response
diff --git a/tests/i18n/utils.py b/tests/i18n/utils.py
index c198afbc43..b2267cd3eb 100644
--- a/tests/i18n/utils.py
+++ b/tests/i18n/utils.py
@@ -12,7 +12,7 @@ def copytree(src, dst):
shutil.copytree(src, dst, ignore=shutil.ignore_patterns('*.pyc', '__pycache__'))
-class POFileAssertionMixin(object):
+class POFileAssertionMixin:
def _assertPoKeyword(self, keyword, expected_value, haystack, use_quotes=True):
q = '"'
@@ -30,7 +30,7 @@ class POFileAssertionMixin(object):
return self._assertPoKeyword('msgid', msgid, haystack, use_quotes=use_quotes)
-class RunInTmpDirMixin(object):
+class RunInTmpDirMixin:
"""
Allow i18n tests that need to generate .po/.mo files to run in an isolated
temporary filesystem tree created by tempfile.mkdtemp() that contains a
diff --git a/tests/invalid_models_tests/test_models.py b/tests/invalid_models_tests/test_models.py
index 7bb9497690..d35f9aa063 100644
--- a/tests/invalid_models_tests/test_models.py
+++ b/tests/invalid_models_tests/test_models.py
@@ -910,7 +910,7 @@ class OtherModelTests(SimpleTestCase):
class Meta:
app_label = 'invalid_models_tests'
- class DummyClass(object):
+ class DummyClass:
def __call__(self, **kwargs):
pass
diff --git a/tests/invalid_models_tests/test_ordinary_fields.py b/tests/invalid_models_tests/test_ordinary_fields.py
index 61f93e8578..f1f1f07766 100644
--- a/tests/invalid_models_tests/test_ordinary_fields.py
+++ b/tests/invalid_models_tests/test_ordinary_fields.py
@@ -155,7 +155,7 @@ class CharFieldTests(TestCase):
self.assertEqual(errors, expected)
def test_iterable_of_iterable_choices(self):
- class ThingItem(object):
+ class ThingItem:
def __init__(self, value, display):
self.value = value
self.display = display
@@ -166,7 +166,7 @@ class CharFieldTests(TestCase):
def __len__(self):
return 2
- class Things(object):
+ class Things:
def __iter__(self):
return (x for x in [ThingItem(1, 2), ThingItem(3, 4)])
diff --git a/tests/logging_tests/tests.py b/tests/logging_tests/tests.py
index a91bcd66bf..6033cac289 100644
--- a/tests/logging_tests/tests.py
+++ b/tests/logging_tests/tests.py
@@ -64,7 +64,7 @@ class LoggingFiltersTest(SimpleTestCase):
self.assertIs(filter_.filter("record is not used"), False)
-class SetupDefaultLoggingMixin(object):
+class SetupDefaultLoggingMixin:
@classmethod
def setUpClass(cls):
diff --git a/tests/mail/tests.py b/tests/mail/tests.py
index 77ea87fe7d..8ba4d64423 100644
--- a/tests/mail/tests.py
+++ b/tests/mail/tests.py
@@ -30,7 +30,7 @@ from django.utils.encoding import force_bytes, force_text
from django.utils.translation import ugettext_lazy
-class HeadersCheckMixin(object):
+class HeadersCheckMixin:
def assertMessageHasHeaders(self, message, headers):
"""
@@ -708,7 +708,7 @@ class PythonGlobalState(SimpleTestCase):
self.assertIn(str('Content-Transfer-Encoding: base64'), txt.as_string())
-class BaseEmailBackendTests(HeadersCheckMixin, object):
+class BaseEmailBackendTests(HeadersCheckMixin):
email_backend = None
def setUp(self):
diff --git a/tests/messages_tests/base.py b/tests/messages_tests/base.py
index 889bcc043a..8082d468fe 100644
--- a/tests/messages_tests/base.py
+++ b/tests/messages_tests/base.py
@@ -36,7 +36,7 @@ class override_settings_tags(override_settings):
base.LEVEL_TAGS = self.old_level_tags
-class BaseTests(object):
+class BaseTests:
storage_class = default_storage
levels = {
'debug': constants.DEBUG,
diff --git a/tests/messages_tests/test_api.py b/tests/messages_tests/test_api.py
index 8baff57c70..3de6b81b7b 100644
--- a/tests/messages_tests/test_api.py
+++ b/tests/messages_tests/test_api.py
@@ -2,7 +2,7 @@ from django.contrib import messages
from django.test import RequestFactory, SimpleTestCase
-class DummyStorage(object):
+class DummyStorage:
"""
dummy message-store to test the api methods
"""
@@ -44,7 +44,7 @@ class ApiTests(SimpleTestCase):
self.assertEqual(self.storage.store, [])
-class CustomRequest(object):
+class CustomRequest:
def __init__(self, request):
self._request = request
diff --git a/tests/middleware_exceptions/middleware.py b/tests/middleware_exceptions/middleware.py
index e704b9f2b5..49e5d43189 100644
--- a/tests/middleware_exceptions/middleware.py
+++ b/tests/middleware_exceptions/middleware.py
@@ -5,7 +5,7 @@ from django.template.response import TemplateResponse
log = []
-class BaseMiddleware(object):
+class BaseMiddleware:
def __init__(self, get_response):
self.get_response = get_response
diff --git a/tests/middleware_exceptions/tests.py b/tests/middleware_exceptions/tests.py
index 230d062c88..0c39f09f91 100644
--- a/tests/middleware_exceptions/tests.py
+++ b/tests/middleware_exceptions/tests.py
@@ -104,7 +104,7 @@ class RootUrlconfTests(SimpleTestCase):
self.client.get("/middleware_exceptions/view/")
-class MyMiddleware(object):
+class MyMiddleware:
def __init__(self, get_response=None):
raise MiddlewareNotUsed
@@ -113,7 +113,7 @@ class MyMiddleware(object):
pass
-class MyMiddlewareWithExceptionMessage(object):
+class MyMiddlewareWithExceptionMessage:
def __init__(self, get_response=None):
raise MiddlewareNotUsed('spam eggs')
diff --git a/tests/migrate_signals/tests.py b/tests/migrate_signals/tests.py
index 97f449e805..563be2a82d 100644
--- a/tests/migrate_signals/tests.py
+++ b/tests/migrate_signals/tests.py
@@ -13,7 +13,7 @@ MIGRATE_VERBOSITY = 1
MIGRATE_INTERACTIVE = False
-class Receiver(object):
+class Receiver:
def __init__(self, signal):
self.call_counter = 0
self.call_args = None
@@ -24,7 +24,7 @@ class Receiver(object):
self.call_args = kwargs
-class OneTimeReceiver(object):
+class OneTimeReceiver:
"""
Special receiver for handle the fact that test runner calls migrate for
several databases and several times for some of them.
diff --git a/tests/migrations/models.py b/tests/migrations/models.py
index 9a34edf349..51679e56bb 100644
--- a/tests/migrations/models.py
+++ b/tests/migrations/models.py
@@ -23,7 +23,7 @@ class UnicodeModel(models.Model):
return self.title
-class Unserializable(object):
+class Unserializable:
"""
An object that migration doesn't know how to serialize.
"""
diff --git a/tests/migrations/routers.py b/tests/migrations/routers.py
index 9857363937..21dfc561bd 100644
--- a/tests/migrations/routers.py
+++ b/tests/migrations/routers.py
@@ -1,8 +1,8 @@
-class EmptyRouter(object):
+class EmptyRouter:
pass
-class TestRouter(object):
+class TestRouter:
def allow_migrate(self, db, app_label, model_name=None, **hints):
"""
The Tribble model should be the only one to appear in the 'other' db.
diff --git a/tests/migrations/test_autodetector.py b/tests/migrations/test_autodetector.py
index e30aeb5d19..df35181d92 100644
--- a/tests/migrations/test_autodetector.py
+++ b/tests/migrations/test_autodetector.py
@@ -17,7 +17,7 @@ from django.test.utils import isolate_lru_cache
from .models import FoodManager, FoodQuerySet
-class DeconstructibleObject(object):
+class DeconstructibleObject:
"""
A custom deconstructible object.
"""
diff --git a/tests/migrations/test_executor.py b/tests/migrations/test_executor.py
index 60e7ec9771..d6cc802149 100644
--- a/tests/migrations/test_executor.py
+++ b/tests/migrations/test_executor.py
@@ -642,13 +642,13 @@ class ExecutorTests(MigrationTestBase):
)
-class FakeLoader(object):
+class FakeLoader:
def __init__(self, graph, applied):
self.graph = graph
self.applied_migrations = applied
-class FakeMigration(object):
+class FakeMigration:
"""Really all we need is any object with a debug-useful repr."""
def __init__(self, name):
self.name = name
diff --git a/tests/migrations/test_multidb.py b/tests/migrations/test_multidb.py
index c6ca4a844e..16cd8f33d1 100644
--- a/tests/migrations/test_multidb.py
+++ b/tests/migrations/test_multidb.py
@@ -12,7 +12,7 @@ except ImportError:
sqlparse = None
-class AgnosticRouter(object):
+class AgnosticRouter:
"""
A router that doesn't have an opinion regarding migrating.
"""
@@ -20,7 +20,7 @@ class AgnosticRouter(object):
return None
-class MigrateNothingRouter(object):
+class MigrateNothingRouter:
"""
A router that doesn't allow migrating.
"""
@@ -28,7 +28,7 @@ class MigrateNothingRouter(object):
return False
-class MigrateEverythingRouter(object):
+class MigrateEverythingRouter:
"""
A router that always allows migrating.
"""
@@ -36,7 +36,7 @@ class MigrateEverythingRouter(object):
return True
-class MigrateWhenFooRouter(object):
+class MigrateWhenFooRouter:
"""
A router that allows migrating depending on a hint.
"""
diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py
index f962f9cf8c..7943b59a44 100644
--- a/tests/migrations/test_operations.py
+++ b/tests/migrations/test_operations.py
@@ -18,7 +18,7 @@ except ImportError:
sqlparse = None
-class Mixin(object):
+class Mixin:
pass
diff --git a/tests/migrations/test_writer.py b/tests/migrations/test_writer.py
index fb16b441d1..ff5e22ac5e 100644
--- a/tests/migrations/test_writer.py
+++ b/tests/migrations/test_writer.py
@@ -485,7 +485,7 @@ class WriterTests(SimpleTestCase):
"""
Neither py2 or py3 can serialize a reference in a local scope.
"""
- class TestModel2(object):
+ class TestModel2:
def upload_to(self):
return "somewhere dynamic"
thing = models.FileField(upload_to=upload_to)
@@ -496,7 +496,7 @@ class WriterTests(SimpleTestCase):
"""
Make sure user is seeing which module/function is the issue
"""
- class TestModel2(object):
+ class TestModel2:
def upload_to(self):
return "somewhere dynamic"
thing = models.FileField(upload_to=upload_to)
@@ -671,7 +671,7 @@ class WriterTests(SimpleTestCase):
# Yes, it doesn't make sense to use a class as a default for a
# CharField. It does make sense for custom fields though, for example
# an enumfield that takes the enum class as an argument.
- class DeconstructibleInstances(object):
+ class DeconstructibleInstances:
def deconstruct(self):
return ('DeconstructibleInstances', [], {})
diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py
index adb90d6d14..da28fcc7d6 100644
--- a/tests/model_forms/tests.py
+++ b/tests/model_forms/tests.py
@@ -2721,7 +2721,7 @@ class ModelFormInheritanceTests(SimpleTestCase):
model = Writer
fields = '__all__'
- class Mixin(object):
+ class Mixin:
age = None
class Form(forms.Form):
diff --git a/tests/model_formsets_regress/tests.py b/tests/model_formsets_regress/tests.py
index 5bad8a741a..64d933f90c 100644
--- a/tests/model_formsets_regress/tests.py
+++ b/tests/model_formsets_regress/tests.py
@@ -312,7 +312,7 @@ class UserSiteForm(forms.ModelForm):
localized_fields = ('data',)
-class Callback(object):
+class Callback:
def __init__(self):
self.log = []
diff --git a/tests/model_inheritance/models.py b/tests/model_inheritance/models.py
index 44bf752d00..62003f032e 100644
--- a/tests/model_inheritance/models.py
+++ b/tests/model_inheritance/models.py
@@ -157,7 +157,7 @@ class NamedURL(models.Model):
abstract = True
-class Mixin(object):
+class Mixin:
def __init__(self):
self.other_attr = 1
super(Mixin, self).__init__()
diff --git a/tests/model_inheritance/test_abstract_inheritance.py b/tests/model_inheritance/test_abstract_inheritance.py
index 6f0b89128b..d74cae7a3b 100644
--- a/tests/model_inheritance/test_abstract_inheritance.py
+++ b/tests/model_inheritance/test_abstract_inheritance.py
@@ -301,10 +301,10 @@ class AbstractInheritanceTests(TestCase):
class Meta:
abstract = True
- class Mixin(object):
+ class Mixin:
age = None
- class Mixin2(object):
+ class Mixin2:
age = 2
class DescendantMixin(Mixin):
diff --git a/tests/modeladmin/test_checks.py b/tests/modeladmin/test_checks.py
index 93b35ecf56..c90ed64958 100644
--- a/tests/modeladmin/test_checks.py
+++ b/tests/modeladmin/test_checks.py
@@ -198,7 +198,7 @@ class FieldsCheckTests(CheckTestCase):
class FormCheckTests(CheckTestCase):
def test_invalid_type(self):
- class FakeForm(object):
+ class FakeForm:
pass
class TestModelAdmin(ModelAdmin):
@@ -578,7 +578,7 @@ class ListFilterTests(CheckTestCase):
)
def test_not_filter(self):
- class RandomClass(object):
+ class RandomClass:
pass
class TestModelAdmin(ModelAdmin):
@@ -590,7 +590,7 @@ class ListFilterTests(CheckTestCase):
'admin.E113')
def test_not_filter_again(self):
- class RandomClass(object):
+ class RandomClass:
pass
class TestModelAdmin(ModelAdmin):
@@ -869,7 +869,7 @@ class InlinesCheckTests(CheckTestCase):
)
def test_not_model_admin(self):
- class ValidationTestInline(object):
+ class ValidationTestInline:
pass
class TestModelAdmin(ModelAdmin):
@@ -894,7 +894,7 @@ class InlinesCheckTests(CheckTestCase):
'admin.E105')
def test_invalid_model_type(self):
- class SomethingBad(object):
+ class SomethingBad:
pass
class ValidationTestInline(TabularInline):
@@ -1034,7 +1034,7 @@ class MinNumCheckTests(CheckTestCase):
class FormsetCheckTests(CheckTestCase):
def test_invalid_type(self):
- class FakeFormSet(object):
+ class FakeFormSet:
pass
class ValidationTestInline(TabularInline):
diff --git a/tests/modeladmin/tests.py b/tests/modeladmin/tests.py
index 12ca86ff1a..1cded986fa 100644
--- a/tests/modeladmin/tests.py
+++ b/tests/modeladmin/tests.py
@@ -14,11 +14,11 @@ from django.test import SimpleTestCase, TestCase
from .models import Band, Concert
-class MockRequest(object):
+class MockRequest:
pass
-class MockSuperUser(object):
+class MockSuperUser:
def has_perm(self, perm):
return True
@@ -589,7 +589,7 @@ class ModelAdminTests(TestCase):
class ModelAdminPermissionTests(SimpleTestCase):
- class MockUser(object):
+ class MockUser:
def has_module_perms(self, app_label):
if app_label == "modeladmin":
return True
diff --git a/tests/multiple_database/routers.py b/tests/multiple_database/routers.py
index e51c82b858..cb12a907c9 100644
--- a/tests/multiple_database/routers.py
+++ b/tests/multiple_database/routers.py
@@ -1,7 +1,7 @@
from django.db import DEFAULT_DB_ALIAS
-class TestRouter(object):
+class TestRouter:
"""
Vaguely behave like primary/replica, but the databases aren't assumed to
propagate changes.
@@ -22,7 +22,7 @@ class TestRouter(object):
return True
-class AuthRouter(object):
+class AuthRouter:
"""
Control all database operations on models in the contrib.auth application.
"""
@@ -54,7 +54,7 @@ class AuthRouter(object):
return None
-class WriteRouter(object):
+class WriteRouter:
# A router that only expresses an opinion on writes
def db_for_write(self, model, **hints):
return 'writer'
diff --git a/tests/multiple_database/tests.py b/tests/multiple_database/tests.py
index 3487894fd9..ec04a37e2f 100644
--- a/tests/multiple_database/tests.py
+++ b/tests/multiple_database/tests.py
@@ -1529,7 +1529,7 @@ class AuthTestCase(TestCase):
self.assertIn('"email": "alice@example.com"', command_output)
-class AntiPetRouter(object):
+class AntiPetRouter:
# A router that only expresses an opinion on migrate,
# passing pets to the 'other' database
@@ -1590,7 +1590,7 @@ class PickleQuerySetTestCase(TestCase):
self.assertEqual(qs.db, pickle.loads(pickle.dumps(qs)).db)
-class DatabaseReceiver(object):
+class DatabaseReceiver:
"""
Used in the tests for the database argument in signals (#13552)
"""
@@ -1598,7 +1598,7 @@ class DatabaseReceiver(object):
self._database = kwargs['using']
-class WriteToOtherRouter(object):
+class WriteToOtherRouter:
"""
A router that sends all writes to the other database.
"""
@@ -1698,7 +1698,7 @@ class SignalTests(TestCase):
self.assertEqual(receiver._database, "other")
-class AttributeErrorRouter(object):
+class AttributeErrorRouter:
"A router to test the exception handling of ConnectionRouter"
def db_for_read(self, model, **hints):
raise AttributeError
@@ -1751,7 +1751,7 @@ class RouterAttributeErrorTestCase(TestCase):
b.authors.set([p])
-class ModelMetaRouter(object):
+class ModelMetaRouter:
"A router to ensure model arguments are real model classes"
def db_for_write(self, model, **hints):
if not hasattr(model, '_meta'):
@@ -1785,7 +1785,7 @@ class RouterModelArgumentTestCase(TestCase):
person.delete()
-class SyncOnlyDefaultDatabaseRouter(object):
+class SyncOnlyDefaultDatabaseRouter:
def allow_migrate(self, db, app_label, **hints):
return db == DEFAULT_DB_ALIAS
@@ -1828,7 +1828,7 @@ class RouterUsed(Exception):
class RouteForWriteTestCase(TestCase):
multi_db = True
- class WriteCheckRouter(object):
+ class WriteCheckRouter:
def db_for_write(self, model, **hints):
raise RouterUsed(mode=RouterUsed.WRITE, model=model, hints=hints)
diff --git a/tests/order_with_respect_to/base_tests.py b/tests/order_with_respect_to/base_tests.py
index ad8925bf88..3ca7ada800 100644
--- a/tests/order_with_respect_to/base_tests.py
+++ b/tests/order_with_respect_to/base_tests.py
@@ -5,7 +5,7 @@ reference any models directly. Subclasses should inherit django.test.TestCase.
from operator import attrgetter
-class BaseOrderWithRespectToTests(object):
+class BaseOrderWithRespectToTests:
# Hook to allow subclasses to run these tests with alternate models.
Answer = None
Post = None
diff --git a/tests/pagination/tests.py b/tests/pagination/tests.py
index 2e2e2d37db..4aaaa3c3de 100644
--- a/tests/pagination/tests.py
+++ b/tests/pagination/tests.py
@@ -124,7 +124,7 @@ class PaginationTests(unittest.TestCase):
self.assertEqual(paginator.validate_number(1), 1)
def test_paginate_misc_classes(self):
- class CountContainer(object):
+ class CountContainer:
def count(self):
return 42
# Paginator can be passed other objects with a count() method.
@@ -134,7 +134,7 @@ class PaginationTests(unittest.TestCase):
self.assertEqual([1, 2, 3, 4, 5], list(paginator.page_range))
# Paginator can be passed other objects that implement __len__.
- class LenContainer(object):
+ class LenContainer:
def __len__(self):
return 42
paginator = Paginator(LenContainer(), 10)
diff --git a/tests/postgres_tests/models.py b/tests/postgres_tests/models.py
index 2a0d69b21a..a77fc4b152 100644
--- a/tests/postgres_tests/models.py
+++ b/tests/postgres_tests/models.py
@@ -8,7 +8,7 @@ from .fields import (
)
-class Tag(object):
+class Tag:
def __init__(self, tag_id):
self.tag_id = tag_id
diff --git a/tests/postgres_tests/test_search.py b/tests/postgres_tests/test_search.py
index 0bf2df50f1..2108beb181 100644
--- a/tests/postgres_tests/test_search.py
+++ b/tests/postgres_tests/test_search.py
@@ -15,7 +15,7 @@ from . import PostgreSQLTestCase
from .models import Character, Line, Scene
-class GrailTestData(object):
+class GrailTestData:
@classmethod
def setUpTestData(cls):
diff --git a/tests/queries/tests.py b/tests/queries/tests.py
index 1f9094e49f..4107dada0e 100644
--- a/tests/queries/tests.py
+++ b/tests/queries/tests.py
@@ -2862,11 +2862,11 @@ class ProxyQueryCleanupTest(TestCase):
class WhereNodeTest(TestCase):
- class DummyNode(object):
+ class DummyNode:
def as_sql(self, compiler, connection):
return 'dummy', []
- class MockCompiler(object):
+ class MockCompiler:
def compile(self, node):
return node.as_sql(self, connection)
diff --git a/tests/queryset_pickle/models.py b/tests/queryset_pickle/models.py
index 4faad0175b..dbd570a30b 100644
--- a/tests/queryset_pickle/models.py
+++ b/tests/queryset_pickle/models.py
@@ -8,7 +8,7 @@ def standalone_number():
return 1
-class Numbers(object):
+class Numbers:
@staticmethod
def get_static_number():
return 2
@@ -47,7 +47,7 @@ class Happening(models.Model):
number2 = models.IntegerField(blank=True, default=Numbers.get_static_number)
-class Container(object):
+class Container:
# To test pickling we need a class that isn't defined on module, but
# is still available from app-cache. So, the Container class moves
# SomeModel outside of module level
diff --git a/tests/serializers/models/base.py b/tests/serializers/models/base.py
index 9421578478..78d832140f 100644
--- a/tests/serializers/models/base.py
+++ b/tests/serializers/models/base.py
@@ -100,7 +100,7 @@ class Score(models.Model):
score = models.FloatField()
-class Team(object):
+class Team:
def __init__(self, title):
self.title = title
diff --git a/tests/serializers/test_yaml.py b/tests/serializers/test_yaml.py
index 542c28fb2e..5a9fa5e873 100644
--- a/tests/serializers/test_yaml.py
+++ b/tests/serializers/test_yaml.py
@@ -18,7 +18,7 @@ except ImportError:
YAML_IMPORT_ERROR_MESSAGE = r'No module named yaml'
-class YamlImportModuleMock(object):
+class YamlImportModuleMock:
"""Provides a wrapped import_module function to simulate yaml ImportError
In order to run tests that verify the behavior of the YAML serializer
diff --git a/tests/serializers/tests.py b/tests/serializers/tests.py
index 5c30d66082..5750c146a2 100644
--- a/tests/serializers/tests.py
+++ b/tests/serializers/tests.py
@@ -88,7 +88,7 @@ class SerializerRegistrationTests(SimpleTestCase):
serializers.get_deserializer("nonsense")
-class SerializersTestBase(object):
+class SerializersTestBase:
serializer_name = None # Set by subclasses to the serialization format name
@staticmethod
@@ -349,7 +349,7 @@ class SerializersTestBase(object):
class SerializerAPITests(SimpleTestCase):
def test_stream_class(self):
- class File(object):
+ class File:
def __init__(self):
self.lines = []
@@ -369,7 +369,7 @@ class SerializerAPITests(SimpleTestCase):
self.assertEqual(data, '[{"model": "serializers.score", "pk": 1, "fields": {"score": 3.4}}]')
-class SerializersTransactionTestBase(object):
+class SerializersTransactionTestBase:
available_apps = ['serializers']
diff --git a/tests/servers/test_basehttp.py b/tests/servers/test_basehttp.py
index cd9bcd2e86..cf0f8ac41b 100644
--- a/tests/servers/test_basehttp.py
+++ b/tests/servers/test_basehttp.py
@@ -8,7 +8,7 @@ from django.test.client import RequestFactory
from django.test.utils import patch_logger
-class Stub(object):
+class Stub:
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
diff --git a/tests/sessions_tests/tests.py b/tests/sessions_tests/tests.py
index 29de5782d9..d4a486b90e 100644
--- a/tests/sessions_tests/tests.py
+++ b/tests/sessions_tests/tests.py
@@ -38,7 +38,7 @@ from django.utils.encoding import force_text
from .models import SessionStore as CustomDatabaseSession
-class SessionTestsMixin(object):
+class SessionTestsMixin:
# This does not inherit from TestCase to avoid any tests being run with this
# class, which wouldn't work, and to allow different TestCase subclasses to
# be used.
diff --git a/tests/signals/tests.py b/tests/signals/tests.py
index 88572ad44f..0c1c885dc4 100644
--- a/tests/signals/tests.py
+++ b/tests/signals/tests.py
@@ -122,7 +122,7 @@ class SignalTests(BaseSignalTest):
)
# #8285: signals can be any callable
- class PostDeleteHandler(object):
+ class PostDeleteHandler:
def __init__(self, data):
self.data = data
@@ -247,7 +247,7 @@ class SignalTests(BaseSignalTest):
dispatching.
"""
- class Handler(object):
+ class Handler:
def __init__(self, param):
self.param = param
self._run = False
diff --git a/tests/sites_tests/tests.py b/tests/sites_tests/tests.py
index 0179500f14..9e2d7ad4fc 100644
--- a/tests/sites_tests/tests.py
+++ b/tests/sites_tests/tests.py
@@ -226,7 +226,7 @@ class SitesFrameworkTests(TestCase):
RequestSite(request).delete()
-class JustOtherRouter(object):
+class JustOtherRouter:
def allow_migrate(self, db, app_label, **hints):
return db == 'other'
diff --git a/tests/staticfiles_tests/cases.py b/tests/staticfiles_tests/cases.py
index 069402c6f6..537fbac6a0 100644
--- a/tests/staticfiles_tests/cases.py
+++ b/tests/staticfiles_tests/cases.py
@@ -12,7 +12,7 @@ from django.utils.encoding import force_text
from .settings import TEST_SETTINGS
-class BaseStaticFilesMixin(object):
+class BaseStaticFilesMixin:
"""
Test case with a couple utility assertions.
"""
@@ -89,7 +89,7 @@ class CollectionTestCase(BaseStaticFilesMixin, SimpleTestCase):
return f.read()
-class TestDefaults(object):
+class TestDefaults:
"""
A few standard test cases.
"""
diff --git a/tests/staticfiles_tests/test_finders.py b/tests/staticfiles_tests/test_finders.py
index 0f5cf5bea2..7df8c50a0d 100644
--- a/tests/staticfiles_tests/test_finders.py
+++ b/tests/staticfiles_tests/test_finders.py
@@ -9,7 +9,7 @@ from .cases import StaticFilesTestCase
from .settings import TEST_ROOT
-class TestFinders(object):
+class TestFinders:
"""
Base finder test mixin.
diff --git a/tests/staticfiles_tests/test_management.py b/tests/staticfiles_tests/test_management.py
index 310c152d06..f0160c60d8 100644
--- a/tests/staticfiles_tests/test_management.py
+++ b/tests/staticfiles_tests/test_management.py
@@ -25,7 +25,7 @@ from .settings import TEST_ROOT, TEST_SETTINGS
from .storage import DummyStorage
-class TestNoFilesCreated(object):
+class TestNoFilesCreated:
def test_no_files_created(self):
"""
diff --git a/tests/staticfiles_tests/test_storage.py b/tests/staticfiles_tests/test_storage.py
index e299feea78..c72100ccb1 100644
--- a/tests/staticfiles_tests/test_storage.py
+++ b/tests/staticfiles_tests/test_storage.py
@@ -23,7 +23,7 @@ def hashed_file_path(test, path):
return fullpath.replace(settings.STATIC_URL, '')
-class TestHashedFiles(object):
+class TestHashedFiles:
hashed_file_path = hashed_file_path
def setUp(self):
diff --git a/tests/template_tests/filter_tests/test_floatformat.py b/tests/template_tests/filter_tests/test_floatformat.py
index 8474238f21..e0f7666ff0 100644
--- a/tests/template_tests/filter_tests/test_floatformat.py
+++ b/tests/template_tests/filter_tests/test_floatformat.py
@@ -72,7 +72,7 @@ class FunctionTests(SimpleTestCase):
self.assertEqual(floatformat(nan), str(nan))
def test_float_dunder_method(self):
- class FloatWrapper(object):
+ class FloatWrapper:
def __init__(self, value):
self.value = value
diff --git a/tests/template_tests/filter_tests/test_unordered_list.py b/tests/template_tests/filter_tests/test_unordered_list.py
index 659b1acc2b..b4d624345b 100644
--- a/tests/template_tests/filter_tests/test_unordered_list.py
+++ b/tests/template_tests/filter_tests/test_unordered_list.py
@@ -87,7 +87,7 @@ class FunctionTests(SimpleTestCase):
)
def test_ulitem(self):
- class ULItem(object):
+ class ULItem:
def __init__(self, title):
self.title = title
@@ -113,7 +113,7 @@ class FunctionTests(SimpleTestCase):
)
def test_ulitem_autoescape_off(self):
- class ULItem(object):
+ class ULItem:
def __init__(self, title):
self.title = title
diff --git a/tests/template_tests/test_callables.py b/tests/template_tests/test_callables.py
index 4cfb49db5c..6a361e8409 100644
--- a/tests/template_tests/test_callables.py
+++ b/tests/template_tests/test_callables.py
@@ -12,7 +12,7 @@ class CallableVariablesTests(TestCase):
def test_callable(self):
- class Doodad(object):
+ class Doodad:
def __init__(self, value):
self.num_calls = 0
self.value = value
@@ -41,7 +41,7 @@ class CallableVariablesTests(TestCase):
def test_alters_data(self):
- class Doodad(object):
+ class Doodad:
alters_data = True
def __init__(self, value):
@@ -68,7 +68,7 @@ class CallableVariablesTests(TestCase):
def test_do_not_call(self):
- class Doodad(object):
+ class Doodad:
do_not_call_in_templates = True
def __init__(self, value):
@@ -100,7 +100,7 @@ class CallableVariablesTests(TestCase):
# ``alters_data`` attribute will not make any difference in the
# template system's behavior.
- class Doodad(object):
+ class Doodad:
do_not_call_in_templates = True
alters_data = True
diff --git a/tests/template_tests/test_logging.py b/tests/template_tests/test_logging.py
index 9dd8046408..e03809d864 100644
--- a/tests/template_tests/test_logging.py
+++ b/tests/template_tests/test_logging.py
@@ -31,7 +31,7 @@ class VariableResolveLoggingTests(BaseTemplateLoggingTestCase):
loglevel = logging.DEBUG
def test_log_on_variable_does_not_exist_silent(self):
- class TestObject(object):
+ class TestObject:
class SilentDoesNotExist(Exception):
silent_variable_failure = True
diff --git a/tests/template_tests/utils.py b/tests/template_tests/utils.py
index 187d259f36..8ee66a6523 100644
--- a/tests/template_tests/utils.py
+++ b/tests/template_tests/utils.py
@@ -142,7 +142,7 @@ class OtherClass:
return 'OtherClass.method'
-class TestObj(object):
+class TestObj:
def is_true(self):
return True
@@ -153,12 +153,12 @@ class TestObj(object):
raise ShouldNotExecuteException()
-class SilentGetItemClass(object):
+class SilentGetItemClass:
def __getitem__(self, key):
raise SomeException
-class SilentAttrClass(object):
+class SilentAttrClass:
def b(self):
raise SomeException
b = property(b)
diff --git a/tests/test_client/auth_backends.py b/tests/test_client/auth_backends.py
index 1bb1d96eeb..97a2763aaa 100644
--- a/tests/test_client/auth_backends.py
+++ b/tests/test_client/auth_backends.py
@@ -5,5 +5,5 @@ class TestClientBackend(ModelBackend):
pass
-class BackendWithoutGetUserMethod(object):
+class BackendWithoutGetUserMethod:
pass
diff --git a/tests/test_client/views.py b/tests/test_client/views.py
index e9a28449ec..bc6a59f760 100644
--- a/tests/test_client/views.py
+++ b/tests/test_client/views.py
@@ -248,7 +248,7 @@ permission_protected_view_exception = (
)
-class _ViewManager(object):
+class _ViewManager:
@method_decorator(login_required)
def login_protected_view(self, request):
t = Template('This is a login protected test using a method. '
diff --git a/tests/test_client_regress/tests.py b/tests/test_client_regress/tests.py
index 0436ae9968..16b344e0ae 100644
--- a/tests/test_client_regress/tests.py
+++ b/tests/test_client_regress/tests.py
@@ -24,7 +24,7 @@ from .models import CustomUser
from .views import CustomTestException
-class TestDataMixin(object):
+class TestDataMixin:
@classmethod
def setUpTestData(cls):
@@ -1298,7 +1298,7 @@ class UnicodePayloadTests(SimpleTestCase):
self.assertEqual(response.content, json.encode('koi8-r'))
-class DummyFile(object):
+class DummyFile:
def __init__(self, filename):
self.name = filename
diff --git a/tests/test_runner/tests.py b/tests/test_runner/tests.py
index 670bc6683c..51810fe7bc 100644
--- a/tests/test_runner/tests.py
+++ b/tests/test_runner/tests.py
@@ -129,7 +129,7 @@ class DependencyOrderingTests(unittest.TestCase):
dependency_ordered(raw, dependencies=dependencies)
-class MockTestRunner(object):
+class MockTestRunner:
def __init__(self, *args, **kwargs):
pass
diff --git a/tests/transactions/tests.py b/tests/transactions/tests.py
index 12d2eb299d..033619c0c8 100644
--- a/tests/transactions/tests.py
+++ b/tests/transactions/tests.py
@@ -413,7 +413,7 @@ class AtomicMiscTests(TransactionTestCase):
def test_wrap_callable_instance(self):
"""#20028 -- Atomic must support wrapping callable instances."""
- class Callable(object):
+ class Callable:
def __call__(self):
pass
diff --git a/tests/urlpatterns_reverse/method_view_urls.py b/tests/urlpatterns_reverse/method_view_urls.py
index c28958e6a9..e91966b4ac 100644
--- a/tests/urlpatterns_reverse/method_view_urls.py
+++ b/tests/urlpatterns_reverse/method_view_urls.py
@@ -1,7 +1,7 @@
from django.conf.urls import url
-class ViewContainer(object):
+class ViewContainer:
def method_view(self, request):
pass
diff --git a/tests/urlpatterns_reverse/tests.py b/tests/urlpatterns_reverse/tests.py
index 62d199c030..efb30dc2ff 100644
--- a/tests/urlpatterns_reverse/tests.py
+++ b/tests/urlpatterns_reverse/tests.py
@@ -518,7 +518,7 @@ class ReverseShortcutTests(SimpleTestCase):
def test_redirect_to_object(self):
# We don't really need a model; just something with a get_absolute_url
- class FakeObj(object):
+ class FakeObj:
def get_absolute_url(self):
return "/hi-there/"
diff --git a/tests/urlpatterns_reverse/utils.py b/tests/urlpatterns_reverse/utils.py
index 22664480d1..8c96d8ca72 100644
--- a/tests/urlpatterns_reverse/utils.py
+++ b/tests/urlpatterns_reverse/utils.py
@@ -3,7 +3,7 @@ from django.conf.urls import url
from . import views
-class URLObject(object):
+class URLObject:
urlpatterns = [
url(r'^inner/$', views.empty_view, name='urlobject-view'),
url(r'^inner/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.empty_view, name='urlobject-view'),
diff --git a/tests/urlpatterns_reverse/views.py b/tests/urlpatterns_reverse/views.py
index e8765367be..584c70a6e5 100644
--- a/tests/urlpatterns_reverse/views.py
+++ b/tests/urlpatterns_reverse/views.py
@@ -35,7 +35,7 @@ def pass_resolver_match_view(request, *args, **kwargs):
uncallable = None # neither a callable nor a string
-class ViewClass(object):
+class ViewClass:
def __call__(self, request, *args, **kwargs):
return HttpResponse('')
diff --git a/tests/utils_tests/test_archive.py b/tests/utils_tests/test_archive.py
index b207a1290a..f50e18d75c 100644
--- a/tests/utils_tests/test_archive.py
+++ b/tests/utils_tests/test_archive.py
@@ -11,7 +11,7 @@ from django.utils.archive import Archive, extract
TEST_DIR = os.path.join(os.path.dirname(upath(__file__)), 'archives')
-class ArchiveTester(object):
+class ArchiveTester:
archive = None
def setUp(self):
diff --git a/tests/utils_tests/test_decorators.py b/tests/utils_tests/test_decorators.py
index a4d080e2d7..fe5db876ef 100644
--- a/tests/utils_tests/test_decorators.py
+++ b/tests/utils_tests/test_decorators.py
@@ -5,7 +5,7 @@ from django.test import RequestFactory, SimpleTestCase
from django.utils.decorators import classproperty, decorator_from_middleware
-class ProcessViewMiddleware(object):
+class ProcessViewMiddleware:
def process_view(self, request, view_func, view_args, view_kwargs):
pass
@@ -18,7 +18,7 @@ def process_view(request):
return HttpResponse()
-class ClassProcessView(object):
+class ClassProcessView:
def __call__(self, request):
return HttpResponse()
@@ -26,7 +26,7 @@ class ClassProcessView(object):
class_process_view = process_view_dec(ClassProcessView())
-class FullMiddleware(object):
+class FullMiddleware:
def process_request(self, request):
request.process_request_reached = True
@@ -112,7 +112,7 @@ class DecoratorFromMiddlewareTests(SimpleTestCase):
class ClassPropertyTest(SimpleTestCase):
def test_getter(self):
- class Foo(object):
+ class Foo:
foo_attr = 123
def __init__(self):
@@ -122,7 +122,7 @@ class ClassPropertyTest(SimpleTestCase):
def foo(cls):
return cls.foo_attr
- class Bar(object):
+ class Bar:
bar = classproperty()
@bar.getter
@@ -135,7 +135,7 @@ class ClassPropertyTest(SimpleTestCase):
self.assertEqual(Bar().bar, 123)
def test_override_getter(self):
- class Foo(object):
+ class Foo:
@classproperty
def foo(cls):
return 123
diff --git a/tests/utils_tests/test_encoding.py b/tests/utils_tests/test_encoding.py
index faf30a59c0..ca9343674d 100644
--- a/tests/utils_tests/test_encoding.py
+++ b/tests/utils_tests/test_encoding.py
@@ -14,7 +14,7 @@ class TestEncodingUtils(unittest.TestCase):
"""
Broken __unicode__/__str__ actually raises an error.
"""
- class MyString(object):
+ class MyString:
def __str__(self):
return b'\xc3\xb6\xc3\xa4\xc3\xbc'
diff --git a/tests/utils_tests/test_functional.py b/tests/utils_tests/test_functional.py
index f53e212f93..befbcf931c 100644
--- a/tests/utils_tests/test_functional.py
+++ b/tests/utils_tests/test_functional.py
@@ -11,7 +11,7 @@ class FunctionalTestCase(unittest.TestCase):
def test_lazy_base_class(self):
"""lazy also finds base class methods in the proxy object"""
- class Base(object):
+ class Base:
def base_method(self):
pass
@@ -23,7 +23,7 @@ class FunctionalTestCase(unittest.TestCase):
def test_lazy_base_class_override(self):
"""lazy finds the correct (overridden) method implementation"""
- class Base(object):
+ class Base:
def method(self):
return 'Base'
@@ -36,7 +36,7 @@ class FunctionalTestCase(unittest.TestCase):
def test_lazy_object_to_string(self):
- class Klazz(object):
+ class Klazz:
def __str__(self):
return "Î am ā Ǩlâzz."
@@ -51,7 +51,7 @@ class FunctionalTestCase(unittest.TestCase):
"""
cached_property caches its value and that it behaves like a property
"""
- class A(object):
+ class A:
@cached_property
def value(self):
diff --git a/tests/utils_tests/test_html.py b/tests/utils_tests/test_html.py
index 8f887fd011..5ffccdae83 100644
--- a/tests/utils_tests/test_html.py
+++ b/tests/utils_tests/test_html.py
@@ -167,7 +167,7 @@ class TestUtilsHtml(SimpleTestCase):
def test_html_safe(self):
@html.html_safe
- class HtmlClass(object):
+ class HtmlClass:
def __str__(self):
return "<h1>I'm a html class!</h1>"
@@ -177,7 +177,7 @@ class TestUtilsHtml(SimpleTestCase):
self.assertEqual(force_text(html_obj), html_obj.__html__())
def test_html_safe_subclass(self):
- class BaseClass(object):
+ class BaseClass:
def __html__(self):
# defines __html__ on its own
return 'some html content'
@@ -198,7 +198,7 @@ class TestUtilsHtml(SimpleTestCase):
msg = "can't apply @html_safe to HtmlClass because it defines __html__()."
with self.assertRaisesMessage(ValueError, msg):
@html.html_safe
- class HtmlClass(object):
+ class HtmlClass:
def __html__(self):
return "<h1>I'm a html class!</h1>"
@@ -206,5 +206,5 @@ class TestUtilsHtml(SimpleTestCase):
msg = "can't apply @html_safe to HtmlClass because it doesn't define __str__()."
with self.assertRaisesMessage(ValueError, msg):
@html.html_safe
- class HtmlClass(object):
+ class HtmlClass:
pass
diff --git a/tests/utils_tests/test_inspect.py b/tests/utils_tests/test_inspect.py
index e9a2cd086f..7464a9226d 100644
--- a/tests/utils_tests/test_inspect.py
+++ b/tests/utils_tests/test_inspect.py
@@ -3,7 +3,7 @@ import unittest
from django.utils import inspect
-class Person(object):
+class Person:
def no_arguments(self):
return None
diff --git a/tests/utils_tests/test_lazyobject.py b/tests/utils_tests/test_lazyobject.py
index 513123ea00..11bf163747 100644
--- a/tests/utils_tests/test_lazyobject.py
+++ b/tests/utils_tests/test_lazyobject.py
@@ -9,7 +9,7 @@ from django.utils.functional import LazyObject, SimpleLazyObject, empty
from .models import Category, CategoryInfo
-class Foo(object):
+class Foo:
"""
A simple class with just one attribute.
"""
@@ -167,7 +167,7 @@ class LazyObjectTestCase(TestCase):
# Tests whether an object's custom `__iter__` method is being
# used when iterating over it.
- class IterObject(object):
+ class IterObject:
def __init__(self, values):
self.values = values
@@ -356,7 +356,7 @@ class SimpleLazyObjectTestCase(LazyObjectTestCase):
self.assertEqual(len(lazy_set), 4)
-class BaseBaz(object):
+class BaseBaz:
"""
A base class with a funky __reduce__ method, meant to simulate the
__reduce__ method of Model, which sets self._django_version.
diff --git a/tests/utils_tests/test_module/__init__.py b/tests/utils_tests/test_module/__init__.py
index 29ee11b722..d8a5fe2ed9 100644
--- a/tests/utils_tests/test_module/__init__.py
+++ b/tests/utils_tests/test_module/__init__.py
@@ -1,4 +1,4 @@
-class SiteMock(object):
+class SiteMock:
_registry = {}
diff --git a/tests/utils_tests/test_module_loading.py b/tests/utils_tests/test_module_loading.py
index 2a524a2cf2..e979b3e7ba 100644
--- a/tests/utils_tests/test_module_loading.py
+++ b/tests/utils_tests/test_module_loading.py
@@ -179,7 +179,7 @@ class AutodiscoverModulesTestCase(SimpleTestCase):
self.assertEqual(site._registry, {'lorem': 'ipsum'})
-class ProxyFinder(object):
+class ProxyFinder:
def __init__(self):
self._cache = {}
@@ -208,7 +208,7 @@ class ProxyFinder(object):
fd.close()
-class TestFinder(object):
+class TestFinder:
def __init__(self, *args, **kwargs):
self.importer = zipimporter(*args, **kwargs)
@@ -219,7 +219,7 @@ class TestFinder(object):
return TestLoader(importer)
-class TestLoader(object):
+class TestLoader:
def __init__(self, importer):
self.importer = importer
diff --git a/tests/utils_tests/test_safestring.py b/tests/utils_tests/test_safestring.py
index 9e99b6e20b..d1ef28944e 100644
--- a/tests/utils_tests/test_safestring.py
+++ b/tests/utils_tests/test_safestring.py
@@ -44,7 +44,7 @@ class SafeStringTest(SimpleTestCase):
self.assertRenderEqual('{{ s }}', 'a&b', s=mark_safe(s))
def test_mark_safe_object_implementing_dunder_str(self):
- class Obj(object):
+ class Obj:
def __str__(self):
return '<obj>'
diff --git a/tests/view_tests/tests/test_debug.py b/tests/view_tests/tests/test_debug.py
index 7a9cea826b..a3938ce848 100644
--- a/tests/view_tests/tests/test_debug.py
+++ b/tests/view_tests/tests/test_debug.py
@@ -32,7 +32,7 @@ from ..views import (
PY36 = sys.version_info >= (3, 6)
-class User(object):
+class User:
def __str__(self):
return 'jacob'
@@ -45,7 +45,7 @@ class CallableSettingWrapperTests(SimpleTestCase):
""" Unittests for CallableSettingWrapper
"""
def test_repr(self):
- class WrappedCallable(object):
+ class WrappedCallable:
def __repr__(self):
return "repr from the wrapped callable"
@@ -422,7 +422,7 @@ class ExceptionReporterTests(SimpleTestCase):
def test_unprintable_values_handling(self):
"Unprintable values should not make the output generation choke."
try:
- class OomOutput(object):
+ class OomOutput:
def __repr__(self):
raise MemoryError('OOM')
oomvalue = OomOutput() # NOQA
@@ -438,7 +438,7 @@ class ExceptionReporterTests(SimpleTestCase):
large = 256 * 1024
repr_of_str_adds = len(repr(''))
try:
- class LargeOutput(object):
+ class LargeOutput:
def __repr__(self):
return repr('A' * large)
largevalue = LargeOutput() # NOQA
@@ -535,7 +535,7 @@ class ExceptionReporterTests(SimpleTestCase):
The error page can be rendered if the current user can't be retrieved
(such as when the database is unavailable).
"""
- class ExceptionUser(object):
+ class ExceptionUser:
def __str__(self):
raise Exception()
@@ -654,7 +654,7 @@ class PlainTextReportTests(SimpleTestCase):
self.assertIn("http://evil.com/", text)
-class ExceptionReportTestMixin(object):
+class ExceptionReportTestMixin:
# Mixin used in the ExceptionReporterFilterTests and
# AjaxResponseExceptionReporterFilter tests below
@@ -951,7 +951,7 @@ class ExceptionReporterFilterTests(ExceptionReportTestMixin, LoggingCaptureMixin
Callable settings which forbid to set attributes should not break
the debug page (#23070).
"""
- class CallableSettingWithSlots(object):
+ class CallableSettingWithSlots:
__slots__ = []
def __call__(self):
diff --git a/tests/view_tests/views.py b/tests/view_tests/views.py
index 5c63111405..2e47037470 100644
--- a/tests/view_tests/views.py
+++ b/tests/view_tests/views.py
@@ -241,7 +241,7 @@ def custom_exception_reporter_filter_view(request):
return technical_500_response(request, *exc_info)
-class Klass(object):
+class Klass:
@sensitive_variables('sauce')
def method(self, request):
diff --git a/tests/wsgi/tests.py b/tests/wsgi/tests.py
index 68e8d4a86d..13c5536520 100644
--- a/tests/wsgi/tests.py
+++ b/tests/wsgi/tests.py
@@ -49,7 +49,7 @@ class WSGITest(SimpleTestCase):
"""
FileResponse uses wsgi.file_wrapper.
"""
- class FileWrapper(object):
+ class FileWrapper:
def __init__(self, filelike, blksize=8192):
filelike.close()
application = get_wsgi_application()