Refs #33476 -- Reformatted code with Black.

This commit is contained in:
django-bot 2022-02-03 20:24:19 +01:00 committed by Mariusz Felisiak
parent f68fa8b45d
commit 9c19aff7c7
1992 changed files with 139577 additions and 96284 deletions

View file

@ -12,7 +12,8 @@ class TestSerializedRollbackInhibitsPostMigrate(TransactionTestCase):
TransactionTestCase._fixture_teardown() inhibits the post_migrate signal
for test classes with serialized_rollback=True.
"""
available_apps = ['test_utils']
available_apps = ["test_utils"]
serialized_rollback = True
def setUp(self):
@ -21,23 +22,27 @@ class TestSerializedRollbackInhibitsPostMigrate(TransactionTestCase):
self.available_apps = None
def tearDown(self):
self.available_apps = ['test_utils']
self.available_apps = ["test_utils"]
@mock.patch('django.test.testcases.call_command')
@mock.patch("django.test.testcases.call_command")
def test(self, call_command):
# with a mocked call_command(), this doesn't have any effect.
self._fixture_teardown()
call_command.assert_called_with(
'flush', interactive=False, allow_cascade=False,
reset_sequences=False, inhibit_post_migrate=True,
database='default', verbosity=0,
"flush",
interactive=False,
allow_cascade=False,
reset_sequences=False,
inhibit_post_migrate=True,
database="default",
verbosity=0,
)
@override_settings(DEBUG=True) # Enable query logging for test_queries_cleared
class TransactionTestCaseDatabasesTests(TestCase):
available_apps = []
databases = {'default', 'other'}
databases = {"default", "other"}
def test_queries_cleared(self):
"""
@ -46,11 +51,13 @@ class TransactionTestCaseDatabasesTests(TestCase):
assertNumQueries() to fail.
"""
for alias in self.databases:
self.assertEqual(len(connections[alias].queries_log), 0, 'Failed for alias %s' % alias)
self.assertEqual(
len(connections[alias].queries_log), 0, "Failed for alias %s" % alias
)
class DisallowedDatabaseQueriesTests(TransactionTestCase):
available_apps = ['test_utils']
available_apps = ["test_utils"]
def test_disallowed_database_queries(self):
message = (
@ -60,4 +67,4 @@ class DisallowedDatabaseQueriesTests(TransactionTestCase):
"isolation and silence this failure."
)
with self.assertRaisesMessage(DatabaseOperationForbidden, message):
Car.objects.using('other').get()
Car.objects.using("other").get()