summaryrefslogtreecommitdiff
path: root/tests/backends/sqlite
diff options
context:
space:
mode:
authorSimon Charette <charettes@users.noreply.github.com>2019-01-09 17:52:36 -0500
committerTim Graham <timograham@gmail.com>2019-01-09 17:52:36 -0500
commitbc05547cd8c1dd511c6b6a6c873a1bc63417b111 (patch)
tree2ba1a136e77b21df2524d5558ea0a6f25d5ff03b /tests/backends/sqlite
parent222caab68a2a7345043d0c50161203cb2cfe70eb (diff)
Fixed #28658 -- Added DISTINCT handling to the Aggregate class.
Diffstat (limited to 'tests/backends/sqlite')
-rw-r--r--tests/backends/sqlite/tests.py12
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