Ticket #15049: django-t15049.diff

File django-t15049.diff, 1.0 KB (added by Alex Gaynor, 14 years ago)

Tests

  • tests/regressiontests/aggregation_regress/tests.py

    diff --git a/tests/regressiontests/aggregation_regress/tests.py b/tests/regressiontests/aggregation_regress/tests.py
    index ec2603f..d62e13e 100644
    a b class AggregationTests(TestCase):  
    725725            attrgetter("name")
    726726        )
    727727
     728    def test_double_annotation_filter(self):
     729        qs = Book.objects.values("name").annotate(
     730            n_authors=Count("authors")
     731        ).filter(
     732            authors__name__startswith="Adrian"
     733        ).annotate(
     734            n_authors2=Count("authors")
     735        )
     736#        import ipdb
     737#        ipdb.set_trace()
     738        self.assertQuerysetEqual(
     739            qs, [
     740                ("The Definitive Guide to Django: Web Development Done Right", 2, 1)
     741            ],
     742            lambda b: (b["name"], b["n_authors"], b["n_authors2"])
     743        )
     744
    728745    @skipUnlessDBFeature('supports_stddev')
    729746    def test_stddev(self):
    730747        self.assertEqual(
Back to Top