Refs #33829 -- Added violation_error_message to constraints' __repr__().

This commit is contained in:
Xavier Fernandez 2023-02-22 21:04:05 +01:00 committed by Mariusz Felisiak
parent dcd9746983
commit 51c9bb7cd1
4 changed files with 58 additions and 3 deletions

View file

@ -386,6 +386,17 @@ class ExclusionConstraintTests(PostgreSQLTestCase):
"(OpClass(F(datespan), name=range_ops), '-|-')] "
"name='exclude_overlapping'>",
)
constraint = ExclusionConstraint(
name="exclude_overlapping",
expressions=[(F("datespan"), RangeOperators.ADJACENT_TO)],
violation_error_message="Overlapping must be excluded",
)
self.assertEqual(
repr(constraint),
"<ExclusionConstraint: index_type='GIST' expressions=["
"(F(datespan), '-|-')] name='exclude_overlapping' "
"violation_error_message='Overlapping must be excluded'>",
)
def test_eq(self):
constraint_1 = ExclusionConstraint(