summaryrefslogtreecommitdiff
path: root/tests/invalid_models_tests/test_models.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/invalid_models_tests/test_models.py')
-rw-r--r--tests/invalid_models_tests/test_models.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/invalid_models_tests/test_models.py b/tests/invalid_models_tests/test_models.py
index 18a59c407d..0f1d1e4dc3 100644
--- a/tests/invalid_models_tests/test_models.py
+++ b/tests/invalid_models_tests/test_models.py
@@ -1191,3 +1191,13 @@ class ConstraintsTests(SimpleTestCase):
)
expected = [] if connection.features.supports_table_check_constraints else [warn, warn]
self.assertCountEqual(errors, expected)
+
+ def test_check_constraints_required_db_features(self):
+ class Model(models.Model):
+ age = models.IntegerField()
+
+ class Meta:
+ required_db_features = {'supports_table_check_constraints'}
+ constraints = [models.CheckConstraint(check=models.Q(age__gte=18), name='is_adult')]
+
+ self.assertEqual(Model.check(), [])