diff options
Diffstat (limited to 'tests/backends/sqlite')
| -rw-r--r-- | tests/backends/sqlite/tests.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/backends/sqlite/tests.py b/tests/backends/sqlite/tests.py index bddaf8620f..c681d39775 100644 --- a/tests/backends/sqlite/tests.py +++ b/tests/backends/sqlite/tests.py @@ -4,6 +4,7 @@ import unittest from django.db import connection, transaction from django.db.models import Avg, StdDev, Sum, Variance +from django.db.models.aggregates import Aggregate from django.db.models.fields import CharField from django.db.utils import NotSupportedError from django.test import ( @@ -34,6 +35,17 @@ class Tests(TestCase): **{'complex': aggregate('last_modified') + aggregate('last_modified')} ) + def test_distinct_aggregation(self): + class DistinctAggregate(Aggregate): + allow_distinct = True + aggregate = DistinctAggregate('first', 'second', distinct=True) + msg = ( + "SQLite doesn't support DISTINCT on aggregate functions accepting " + "multiple arguments." + ) + with self.assertRaisesMessage(NotSupportedError, msg): + connection.ops.check_expression_support(aggregate) + def test_memory_db_test_name(self): """A named in-memory db should be allowed where supported.""" from django.db.backends.sqlite3.base import DatabaseWrapper |
