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

@ -5,17 +5,20 @@ from django.db.backends.mysql.features import DatabaseFeatures
from django.test import TestCase
@skipUnless(connection.vendor == 'mysql', 'MySQL tests')
@skipUnless(connection.vendor == "mysql", "MySQL tests")
class TestFeatures(TestCase):
def test_supports_transactions(self):
"""
All storage engines except MyISAM support transactions.
"""
with mock.patch('django.db.connection.features._mysql_storage_engine', 'InnoDB'):
with mock.patch(
"django.db.connection.features._mysql_storage_engine", "InnoDB"
):
self.assertTrue(connection.features.supports_transactions)
del connection.features.supports_transactions
with mock.patch('django.db.connection.features._mysql_storage_engine', 'MyISAM'):
with mock.patch(
"django.db.connection.features._mysql_storage_engine", "MyISAM"
):
self.assertFalse(connection.features.supports_transactions)
del connection.features.supports_transactions
@ -35,6 +38,6 @@ class TestFeatures(TestCase):
def test_allows_auto_pk_0(self):
with mock.MagicMock() as _connection:
_connection.sql_mode = {'NO_AUTO_VALUE_ON_ZERO'}
_connection.sql_mode = {"NO_AUTO_VALUE_ON_ZERO"}
database_features = DatabaseFeatures(_connection)
self.assertIs(database_features.allows_auto_pk_0, True)