diff options
author | Xavier Fernandez <xavier.fernandez@beta.gouv.fr> | 2023-02-22 21:04:05 +0100 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-02-23 05:35:58 +0100 |
commit | 51c9bb7cd16081133af4f0ab6d06572660309730 (patch) | |
tree | 32d561be83447b8d372d0b9d4d9d29eebf2810da /tests/postgres_tests | |
parent | dcd974698301a38081c141ccba6dcafa5ed2c80e (diff) | |
download | django-51c9bb7cd16081133af4f0ab6d06572660309730.tar.gz |
Refs #33829 -- Added violation_error_message to constraints' __repr__().
Diffstat (limited to 'tests/postgres_tests')
-rw-r--r-- | tests/postgres_tests/test_constraints.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/postgres_tests/test_constraints.py b/tests/postgres_tests/test_constraints.py index e601f347eb..a5248e1491 100644 --- a/tests/postgres_tests/test_constraints.py +++ b/tests/postgres_tests/test_constraints.py @@ -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( |