summaryrefslogtreecommitdiff
path: root/tests/backends
diff options
context:
space:
mode:
authorAdam Johnson <me@adamj.eu>2026-02-11 23:25:47 +0000
committerJacob Walls <jacobtylerwalls@gmail.com>2026-02-12 15:27:11 -0500
commit055d7a682f4923fc5a50d7c1a12fd7f52675f7e8 (patch)
treef0f412259d1bf42a81f7ee22f6d485caba35a960 /tests/backends
parent0dd9d5ee5c30e51754d93e926e24ff92654ecf5d (diff)
Improved error message in SQLite `DatabaseOperations.check_expression_support()`.
Diffstat (limited to 'tests/backends')
-rw-r--r--tests/backends/sqlite/tests.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/backends/sqlite/tests.py b/tests/backends/sqlite/tests.py
index 34c0eca0ff..f47e96be4e 100644
--- a/tests/backends/sqlite/tests.py
+++ b/tests/backends/sqlite/tests.py
@@ -31,13 +31,17 @@ class Tests(TestCase):
def test_aggregation(self):
"""Raise NotSupportedError when aggregating on date/time fields."""
for aggregate in (Sum, Avg, Variance, StdDev):
- with self.assertRaises(NotSupportedError):
+ msg = (
+ f"SQLite does not support {aggregate.__name__} on date or "
+ "time fields, because they are stored as text."
+ )
+ with self.assertRaisesMessage(NotSupportedError, msg):
Item.objects.aggregate(aggregate("time"))
- with self.assertRaises(NotSupportedError):
+ with self.assertRaisesMessage(NotSupportedError, msg):
Item.objects.aggregate(aggregate("date"))
- with self.assertRaises(NotSupportedError):
+ with self.assertRaisesMessage(NotSupportedError, msg):
Item.objects.aggregate(aggregate("last_modified"))
- with self.assertRaises(NotSupportedError):
+ with self.assertRaisesMessage(NotSupportedError, msg):
Item.objects.aggregate(
**{
"complex": aggregate("last_modified")