summaryrefslogtreecommitdiff
path: root/tests/schema
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2024-02-26 00:14:26 -0500
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2024-03-01 07:15:32 +0100
commitdaf7d482dbaaa2604241a994c49f442fa15142c1 (patch)
tree65eae557dbe8694e03130cc17259a792792c95b7 /tests/schema
parentf82c67aa217c8dd4320ef697b04a6da1681aa799 (diff)
Refs #35234 -- Deprecated CheckConstraint.check in favor of .condition.
Once the deprecation period ends CheckConstraint.check() can become the documented method that performs system checks for BaseConstraint subclasses.
Diffstat (limited to 'tests/schema')
-rw-r--r--tests/schema/tests.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/schema/tests.py b/tests/schema/tests.py
index 52f5f289a1..b912d353eb 100644
--- a/tests/schema/tests.py
+++ b/tests/schema/tests.py
@@ -2791,7 +2791,7 @@ class SchemaTests(TransactionTestCase):
self.isolated_local_models = [DurationModel]
constraint_name = "duration_gte_5_minutes"
constraint = CheckConstraint(
- check=Q(duration__gt=datetime.timedelta(minutes=5)),
+ condition=Q(duration__gt=datetime.timedelta(minutes=5)),
name=constraint_name,
)
DurationModel._meta.constraints = [constraint]
@@ -2821,7 +2821,7 @@ class SchemaTests(TransactionTestCase):
self.isolated_local_models = [JSONConstraintModel]
constraint_name = "check_only_stable_version"
constraint = CheckConstraint(
- check=Q(data__version="stable"),
+ condition=Q(data__version="stable"),
name=constraint_name,
)
JSONConstraintModel._meta.constraints = [constraint]
@@ -2845,7 +2845,7 @@ class SchemaTests(TransactionTestCase):
editor.create_model(Author)
# Add the custom check constraint
constraint = CheckConstraint(
- check=Q(height__gte=0), name="author_height_gte_0_check"
+ condition=Q(height__gte=0), name="author_height_gte_0_check"
)
custom_constraint_name = constraint.name
Author._meta.constraints = [constraint]
@@ -3256,7 +3256,9 @@ class SchemaTests(TransactionTestCase):
"supports_column_check_constraints", "can_introspect_check_constraints"
)
def test_composed_check_constraint_with_fk(self):
- constraint = CheckConstraint(check=Q(author__gt=0), name="book_author_check")
+ constraint = CheckConstraint(
+ condition=Q(author__gt=0), name="book_author_check"
+ )
self._test_composed_constraint_with_fk(constraint)
@skipUnlessDBFeature("allows_multiple_constraints_on_same_fields")