Ticket #28289: 28289-test.diff

File 28289-test.diff, 918 bytes (added by Tim Graham, 2 years ago)
  • tests/annotations/tests.py

    diff --git a/tests/annotations/tests.py b/tests/annotations/tests.py
    index 981e73e..68c5ca2 100644
    a b class NonAggregateAnnotationTestCase(TestCase): 
    374374            lambda a: (a['age'], a['age_count'])
    375375        )
    376376
     377    def test_count_on_child_with_raw_sql_annotation_on_parent(self):
     378        DepartmentStore.objects.create(
     379            name='Angus & Robinson',
     380            original_opening=datetime.date(2014, 3, 8),
     381            friday_night_closing=datetime.time(21, 00, 00),
     382            chain='Westfield',
     383        )
     384        from django.db.models.expressions import RawSQL
     385        self.assertEqual(DepartmentStore.objects.annotate(title=RawSQL('name', ())).count(), 1)
     386
    377387    def test_annotate_exists(self):
    378388        authors = Author.objects.annotate(c=Count('id')).filter(c__gt=1)
    379389        self.assertFalse(authors.exists())
Back to Top