From 055d7a682f4923fc5a50d7c1a12fd7f52675f7e8 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 11 Feb 2026 23:25:47 +0000 Subject: Improved error message in SQLite `DatabaseOperations.check_expression_support()`. --- tests/backends/sqlite/tests.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'tests/backends/sqlite') 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") -- cgit v1.3