diff options
author | Simon Charette <charettes@users.noreply.github.com> | 2017-01-19 02:39:46 -0500 |
---|---|---|
committer | Claude Paroz <claude@2xlibre.net> | 2017-01-19 08:39:46 +0100 |
commit | cecc079168e8669138728d31611ff3a1e7eb3a9f (patch) | |
tree | 2415083d44f84c6f206930fc689a8c0e50a98caa /tests/multiple_database | |
parent | a5563963397aeee30c32e3c1dab31bfe453ca89f (diff) | |
download | django-cecc079168e8669138728d31611ff3a1e7eb3a9f.tar.gz |
Refs #23919 -- Stopped inheriting from object to define new style classes.
Diffstat (limited to 'tests/multiple_database')
-rw-r--r-- | tests/multiple_database/routers.py | 6 | ||||
-rw-r--r-- | tests/multiple_database/tests.py | 14 |
2 files changed, 10 insertions, 10 deletions
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) |