diff --git a/tests/constraints/tests.py b/tests/constraints/tests.py
index 4032b418b4..d4054dfd77 100644
a
|
b
|
class UniqueConstraintTests(TestCase):
|
685 | 685 | exclude={"color"}, |
686 | 686 | ) |
687 | 687 | |
| 688 | def test_validate_expression_str(self): |
| 689 | constraint = models.UniqueConstraint("name", name="name_uniq") |
| 690 | msg = "Constraint “name_uniq” is violated." |
| 691 | with self.assertRaisesMessage(ValidationError, msg): |
| 692 | constraint.validate( |
| 693 | UniqueConstraintProduct, |
| 694 | UniqueConstraintProduct(name=self.p1.name), |
| 695 | ) |
| 696 | constraint.validate( |
| 697 | UniqueConstraintProduct, |
| 698 | UniqueConstraintProduct(name=self.p1.name), |
| 699 | exclude={"name"}, |
| 700 | ) |
| 701 | |
688 | 702 | def test_name(self): |
689 | 703 | constraints = get_constraints(UniqueConstraintProduct._meta.db_table) |
690 | 704 | expected_name = "name_color_uniq" |