Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Failing test for multiple annotation.

  • Loading branch information...
commit 2586758f2f7fa5ae1dc20c1b2847fa6c132f2233 1 parent ce738d6
@ternus ternus authored
Showing with 8 additions and 0 deletions.
  1. +8 −0 tests.py
View
8 tests.py
@@ -2478,6 +2478,14 @@ def test_annotate_custom_aggregate(self):
'SELECT t1.`id`, t1.`title`, MAX(t2.`pub_date`) AS max_pub FROM `blog` AS t1 INNER JOIN `entry` AS t2 ON t1.`id` = t2.`blog_id` GROUP BY t1.`id`, t1.`title`', []
))
+ def test_annotate_multiple(self):
+ annotated = Blog.select().annotate(Entry).annotate(Entry, Max('pub_date', 'max_pub'))
+ self.assertSQLEqual(annotated.sql(), (
+ 'SELECT t1."id", t1."title", COUNT(t2.`pk`) AS count, MAX(t2."pub_date") AS max_pub FROM "blog" AS t1 INNER JOIN "entry" AS t2 ON t1."id" = t2."blog_id" GROUP BY t1."id", t1."title"', []
+ ))
+ # No leftover asterisks
+ self.assertEqual(annotated.sql()[0].count('*'), 0)
+
def test_aggregate(self):
blergs = [Blog.create(title='b%d' % i) for i in range(10)]
Please sign in to comment.
Something went wrong with that request. Please try again.