|
@@ -7,8 +7,6 @@ from django.db.models.constraints import BaseConstraint, UniqueConstraint
|
|
|
from django.db.models.functions import Abs, Lower, Sqrt, Upper
|
|
|
from django.db.transaction import atomic
|
|
|
from django.test import SimpleTestCase, TestCase, skipIfDBFeature, skipUnlessDBFeature
|
|
|
-from django.test.utils import ignore_warnings
|
|
|
-from django.utils.deprecation import RemovedInDjango60Warning
|
|
|
|
|
|
from .models import (
|
|
|
ChildModel,
|
|
@@ -399,23 +397,6 @@ class CheckConstraintTests(TestCase):
|
|
|
constraint.validate(model, invalid_product, exclude={"price"})
|
|
|
constraint.validate(model, invalid_product, exclude={"rebate"})
|
|
|
|
|
|
- def test_check_deprecation(self):
|
|
|
- msg = "CheckConstraint.check is deprecated in favor of `.condition`."
|
|
|
- condition = models.Q(foo="bar")
|
|
|
- with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx:
|
|
|
- constraint = models.CheckConstraint(name="constraint", check=condition)
|
|
|
- self.assertEqual(ctx.filename, __file__)
|
|
|
- with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx:
|
|
|
- self.assertIs(constraint.check, condition)
|
|
|
- self.assertEqual(ctx.filename, __file__)
|
|
|
- other_condition = models.Q(something="else")
|
|
|
- with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx:
|
|
|
- constraint.check = other_condition
|
|
|
- self.assertEqual(ctx.filename, __file__)
|
|
|
- with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx:
|
|
|
- self.assertIs(constraint.check, other_condition)
|
|
|
- self.assertEqual(ctx.filename, __file__)
|
|
|
-
|
|
|
def test_database_default(self):
|
|
|
models.CheckConstraint(
|
|
|
condition=models.Q(field_with_db_default="field_with_db_default"),
|