Ticket #15049: 15049-test.diff

File 15049-test.diff, 930 bytes (added by Tim Graham, 9 years ago)
  • tests/aggregation_regress/tests.py

    diff --git a/tests/aggregation_regress/tests.py b/tests/aggregation_regress/tests.py
    index 44c0f0c..9a5232d 100644
    a b class AggregationTests(TestCase):  
    926926            lambda b: (b.name, b.authorCount)
    927927        )
    928928
     929    def test_double_annotation_filter(self):
     930        qs = Book.objects.values("name").annotate(
     931            n_authors=Count("authors"),
     932        ).filter(
     933            authors__name__startswith="Adrian",
     934        ).annotate(
     935            n_authors2=Count("authors"),
     936        )
     937        self.assertQuerysetEqual(
     938            qs, [
     939                ("The Definitive Guide to Django: Web Development Done Right", 2, 1)
     940            ],
     941            lambda b: (b["name"], b["n_authors"], b["n_authors2"])
     942        )
     943
    929944    @skipUnlessDBFeature('supports_stddev')
    930945    def test_stddev(self):
    931946        self.assertEqual(
Back to Top