mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #32458 -- Made __repr__() for Index and BaseConstraint subclasses more consistent.
This commit is contained in:
committed by
Mariusz Felisiak
parent
7c18b22e2f
commit
87acbf0631
@@ -58,12 +58,14 @@ class CheckConstraintTests(TestCase):
|
||||
self.assertNotEqual(models.CheckConstraint(check=check1, name='price'), 1)
|
||||
|
||||
def test_repr(self):
|
||||
check = models.Q(price__gt=models.F('discounted_price'))
|
||||
name = 'price_gt_discounted_price'
|
||||
constraint = models.CheckConstraint(check=check, name=name)
|
||||
constraint = models.CheckConstraint(
|
||||
check=models.Q(price__gt=models.F('discounted_price')),
|
||||
name='price_gt_discounted_price',
|
||||
)
|
||||
self.assertEqual(
|
||||
repr(constraint),
|
||||
"<CheckConstraint: check='{}' name='{}'>".format(check, name),
|
||||
"<CheckConstraint: check=(AND: ('price__gt', F(discounted_price))) "
|
||||
"name='price_gt_discounted_price'>",
|
||||
)
|
||||
|
||||
def test_invalid_check_types(self):
|
||||
|
||||
Reference in New Issue
Block a user