mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Refs #30581 -- Moved CheckConstraint tests for conditional expressions to migrations.test_operations.
This allows avoiding warning in tests about using RawSQL in CheckConstraints.
This commit is contained in:
parent
c5cc750b56
commit
27b07a3246
3 changed files with 42 additions and 27 deletions
|
@ -103,18 +103,6 @@ class CheckConstraintTests(TestCase):
|
|||
with self.assertRaises(IntegrityError):
|
||||
Product.objects.create(price=10, discounted_price=7, unit="l")
|
||||
|
||||
@skipUnlessDBFeature("supports_table_check_constraints")
|
||||
def test_database_constraint_expression(self):
|
||||
Product.objects.create(price=999, discounted_price=5)
|
||||
with self.assertRaises(IntegrityError):
|
||||
Product.objects.create(price=1000, discounted_price=5)
|
||||
|
||||
@skipUnlessDBFeature("supports_table_check_constraints")
|
||||
def test_database_constraint_expressionwrapper(self):
|
||||
Product.objects.create(price=499, discounted_price=5)
|
||||
with self.assertRaises(IntegrityError):
|
||||
Product.objects.create(price=500, discounted_price=5)
|
||||
|
||||
@skipUnlessDBFeature(
|
||||
"supports_table_check_constraints", "can_introspect_check_constraints"
|
||||
)
|
||||
|
@ -122,8 +110,6 @@ class CheckConstraintTests(TestCase):
|
|||
constraints = get_constraints(Product._meta.db_table)
|
||||
for expected_name in (
|
||||
"price_gt_discounted_price",
|
||||
"constraints_price_lt_1000_raw",
|
||||
"constraints_price_neq_500_wrap",
|
||||
"constraints_product_price_gt_0",
|
||||
):
|
||||
with self.subTest(expected_name):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue