          self.assertEqual(repr(Sum('a')), "Sum(F(a))")
          self.assertEqual(repr(Variance('a', sample=True)), "Variance(F(a), sample=True)")
  
      def test_filtered_aggregates(self):
          filter = Q(a=1)
          self.assertEqual(repr(Avg('a', filter=filter)), "Avg(F(a), filter=(AND: ('a', 1)))")
          self.assertEqual(repr(Count('a', filter=filter)), "Count(F(a), filter=(AND: ('a', 1)))")
 
</s> remove         self.assertEqual(repr(Count('a', filter=filter)), "Count(F(a), distinct=False, filter=(AND: ('a', 1)))")
 </s> add         self.assertEqual(repr(Count('a', filter=filter)), "Count(F(a), filter=(AND: ('a', 1)))") </s> remove         self.assertEqual(repr(Count('a')), "Count(F(a), distinct=False)")
        self.assertEqual(repr(Count('*')), "Count('*', distinct=False)")
 </s> add         self.assertEqual(repr(Count('a')), "Count(F(a))")
        self.assertEqual(repr(Count('*')), "Count('*')") </s> remove         super().__init__(*args, **kwargs)
 </s> add         super().__init__(*expressions, **extra) </s> remove     def __init__(self, *args, filter=None, **kwargs):
 </s> add     def __init__(self, *expressions, distinct=False, filter=None, **extra):
        if distinct and not self.allow_distinct:
            raise TypeError("%s does not allow distinct." % self.__class__.__name__)
        self.distinct = distinct
    def test_distinct_aggregates(self):
        self.assertEqual(repr(Count('a', distinct=True)), "Count(F(a), distinct=True)")
        self.assertEqual(repr(Count('*', distinct=True)), "Count('*', distinct=True)")

          self.assertEqual(repr(Sum('a')), "Sum(F(a))")
          self.assertEqual(repr(Variance('a', sample=True)), "Variance(F(a), sample=True)")
  
    def test_distinct_aggregates(self):
        self.assertEqual(repr(Count('a', distinct=True)), "Count(F(a), distinct=True)")
        self.assertEqual(repr(Count('*', distinct=True)), "Count('*', distinct=True)")

      def test_filtered_aggregates(self):
          filter = Q(a=1)
          self.assertEqual(repr(Avg('a', filter=filter)), "Avg(F(a), filter=(AND: ('a', 1)))")
          self.assertEqual(repr(Count('a', filter=filter)), "Count(F(a), filter=(AND: ('a', 1)))")
keep keep add keep keep keep keep
 Fixed #28658 -- Added DISTINCT handling to the Aggregate class. 
tests/expressions/tests.py