Commits  committed 1403e7c

fix and test for aggregate count with a blank __in=

  • Participants
  • Parent commits b8cd003
  • Branches default

Comments (0)

Files changed (2)

File johnny/

                 if result_type == MULTI:
                     # this was moved in 1.2 to compiler
                     return compiler.empty_iter()
+                else:
+                    return
             db = getattr(cls, 'using', 'default')
             key, val = None, None
             except EmptyResultSet:
                 if result_type == MULTI:
                     return query.empty_iter()
+                else:
+                    return
             val, key = None, None
             # check the blacklist for any of the involved tables;  if it's not

File johnny/tests/

         self.failUnless(not q.get_nowait())
+    def test_empty_count(self):
+        """Test for an empty count aggregate query with an IN"""
+        from testapp.models import Genre
+        books = Genre.objects.filter(id__in=[])
+        count = books.count()
+        self.failUnless(count == 0)
     def test_queryset_laziness(self):
         """This test exists to model the laziness of our queries;  the