1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

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

@@ -6,7 +6,7 @@ from django.test import SimpleTestCase
from django.test.utils import isolate_apps
@isolate_apps('invalid_models_tests')
@isolate_apps("invalid_models_tests")
class DeprecatedFieldsTests(SimpleTestCase):
def test_IPAddressField_deprecated(self):
class IPAddressModel(models.Model):
@@ -15,13 +15,15 @@ class DeprecatedFieldsTests(SimpleTestCase):
model = IPAddressModel()
self.assertEqual(
model.check(),
[checks.Error(
'IPAddressField has been removed except for support in '
'historical migrations.',
hint='Use GenericIPAddressField instead.',
obj=IPAddressModel._meta.get_field('ip'),
id='fields.E900',
)],
[
checks.Error(
"IPAddressField has been removed except for support in "
"historical migrations.",
hint="Use GenericIPAddressField instead.",
obj=IPAddressModel._meta.get_field("ip"),
id="fields.E900",
)
],
)
def test_CommaSeparatedIntegerField_deprecated(self):
@@ -31,13 +33,15 @@ class DeprecatedFieldsTests(SimpleTestCase):
model = CommaSeparatedIntegerModel()
self.assertEqual(
model.check(),
[checks.Error(
'CommaSeparatedIntegerField is removed except for support in '
'historical migrations.',
hint='Use CharField(validators=[validate_comma_separated_integer_list]) instead.',
obj=CommaSeparatedIntegerModel._meta.get_field('csi'),
id='fields.E901',
)],
[
checks.Error(
"CommaSeparatedIntegerField is removed except for support in "
"historical migrations.",
hint="Use CharField(validators=[validate_comma_separated_integer_list]) instead.",
obj=CommaSeparatedIntegerModel._meta.get_field("csi"),
id="fields.E901",
)
],
)
def test_nullbooleanfield_deprecated(self):
@@ -45,29 +49,35 @@ class DeprecatedFieldsTests(SimpleTestCase):
nb = models.NullBooleanField()
model = NullBooleanFieldModel()
self.assertEqual(model.check(), [
checks.Error(
'NullBooleanField is removed except for support in historical '
'migrations.',
hint='Use BooleanField(null=True) instead.',
obj=NullBooleanFieldModel._meta.get_field('nb'),
id='fields.E903',
),
])
self.assertEqual(
model.check(),
[
checks.Error(
"NullBooleanField is removed except for support in historical "
"migrations.",
hint="Use BooleanField(null=True) instead.",
obj=NullBooleanFieldModel._meta.get_field("nb"),
id="fields.E903",
),
],
)
@skipUnless(connection.vendor == 'postgresql', 'PostgreSQL specific SQL')
@skipUnless(connection.vendor == "postgresql", "PostgreSQL specific SQL")
def test_postgres_jsonfield_deprecated(self):
from django.contrib.postgres.fields import JSONField
class PostgresJSONFieldModel(models.Model):
field = JSONField()
self.assertEqual(PostgresJSONFieldModel.check(), [
checks.Error(
'django.contrib.postgres.fields.JSONField is removed except '
'for support in historical migrations.',
hint='Use django.db.models.JSONField instead.',
obj=PostgresJSONFieldModel._meta.get_field('field'),
id='fields.E904',
),
])
self.assertEqual(
PostgresJSONFieldModel.check(),
[
checks.Error(
"django.contrib.postgres.fields.JSONField is removed except "
"for support in historical migrations.",
hint="Use django.db.models.JSONField instead.",
obj=PostgresJSONFieldModel._meta.get_field("field"),
id="fields.E904",
),
],
)