1
0
mirror of https://github.com/django/django.git synced 2024-12-23 17:46:27 +00:00
django/tests/invalid_models_tests/test_deprecated_fields.py

23 lines
695 B
Python

from django.core import checks
from django.db import models
from .base import IsolatedModelsTestCase
class DeprecatedFieldssTests(IsolatedModelsTestCase):
def test_IPAddressField_deprecated(self):
class IPAddressModel(models.Model):
ip = models.IPAddressField()
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',
)],
)