diff options
| author | Simon Charette <charette.s@gmail.com> | 2025-01-20 22:26:01 -0500 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2025-01-22 08:56:18 +0100 |
| commit | a76035e925ff4e6d8676c65cb135c74b993b1039 (patch) | |
| tree | 3f4d7a2f52aa4e350d8e3f2bde28e2c1602eca66 /tests/composite_pk | |
| parent | 136a1e89278070fd100f27d9519529be8a8a8c10 (diff) | |
Refs #36042 -- Consolidated composite expression checks in BaseExpression.
Remove redundant Func.resolve_expression and adjust CombinedExpression to
delegate source expression resolving to super() to perform checks against
allows_composite_expressions in a single location.
Diffstat (limited to 'tests/composite_pk')
| -rw-r--r-- | tests/composite_pk/test_aggregate.py | 2 | ||||
| -rw-r--r-- | tests/composite_pk/test_filter.py | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/tests/composite_pk/test_aggregate.py b/tests/composite_pk/test_aggregate.py index e8751df0a3..d852fdce30 100644 --- a/tests/composite_pk/test_aggregate.py +++ b/tests/composite_pk/test_aggregate.py @@ -138,6 +138,6 @@ class CompositePKAggregateTests(TestCase): ) def test_max_pk(self): - msg = "Max does not support composite primary keys." + msg = "Max expression does not support composite primary keys." with self.assertRaisesMessage(ValueError, msg): Comment.objects.aggregate(Max("pk")) diff --git a/tests/composite_pk/test_filter.py b/tests/composite_pk/test_filter.py index 4edf947423..aa2d9ebe36 100644 --- a/tests/composite_pk/test_filter.py +++ b/tests/composite_pk/test_filter.py @@ -63,7 +63,7 @@ class CompositePKFilterTests(TestCase): Comment.objects.filter(text__gt=F("pk")).count() def test_rhs_combinable(self): - msg = "CompositePrimaryKey is not combinable." + msg = "CombinedExpression expression does not support composite primary keys." for expr in [F("pk") + (1, 1), (1, 1) + F("pk")]: with ( self.subTest(expression=expr), @@ -405,7 +405,7 @@ class CompositePKFilterTests(TestCase): self.assertSequenceEqual(queryset, (self.user_2,)) def test_cannot_cast_pk(self): - msg = "Cast does not support composite primary keys." + msg = "Cast expression does not support composite primary keys." with self.assertRaisesMessage(ValueError, msg): Comment.objects.filter(text__gt=Cast(F("pk"), TextField())).count() |
