summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2025-01-20 22:26:01 -0500
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-01-22 08:57:40 +0100
commite306687a3a5507d59365ba9bf545010e5fd4b2a8 (patch)
tree0ca0cf7c090036ccdb40a3cf02e4f43b5bbde872 /tests
parentae2f5381fe8d4c606f9af4ecc34fb8ca7698da9f (diff)
[5.2.x] 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. Backport of a76035e925ff4e6d8676c65cb135c74b993b1039 from main.
Diffstat (limited to 'tests')
-rw-r--r--tests/composite_pk/test_aggregate.py2
-rw-r--r--tests/composite_pk/test_filter.py4
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()