diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-11-23 09:35:48 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-23 09:35:48 +0100 |
| commit | a411b909671b7b8f8773af6b7cffa6992fe29138 (patch) | |
| tree | fbd12378757f39924b79417f28737bef8d076097 | |
| parent | 4035bab56f2862a25cd7bfba41a84e58672cb1cc (diff) | |
Refs #33050 -- Added test for QuerySet.count() on combined queries with select_related().
Thanks Simon Charette for noticing this.
Fixed in 70499b25c708557fb9ee2264686cd172f4b2354e.
| -rw-r--r-- | tests/queries/test_qs_combinators.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/queries/test_qs_combinators.py b/tests/queries/test_qs_combinators.py index 9d4988d6eb..6358e537ae 100644 --- a/tests/queries/test_qs_combinators.py +++ b/tests/queries/test_qs_combinators.py @@ -424,6 +424,12 @@ class QuerySetSetOperationTests(TestCase): qs = Number.objects.filter(pk__in=[]) self.assertEqual(qs.union(qs).count(), 0) + def test_count_union_with_select_related(self): + e1 = ExtraInfo.objects.create(value=1, info="e1") + Author.objects.create(name="a1", num=1, extra=e1) + qs = Author.objects.select_related("extra").order_by() + self.assertEqual(qs.union(qs).count(), 1) + @skipUnlessDBFeature("supports_select_difference") def test_count_difference(self): qs1 = Number.objects.filter(num__lt=10) |
