server/test/unittest_querier.py
branchstable
changeset 6050 20af96a6fffc
parent 5811 e77cea9721e7
child 6081 ede33e6400ab
child 6189 9fa02f352c8c
--- a/server/test/unittest_querier.py	Mon Aug 02 10:09:29 2010 +0200
+++ b/server/test/unittest_querier.py	Mon Aug 02 12:35:24 2010 +0200
@@ -836,7 +836,7 @@
         rset = self.execute('Any X, NOW - CD WHERE X is Personne, X creation_date CD')
         self.failUnlessEqual(rset.description[0][1], 'Interval')
 
-    def test_select_subquery_aggregat(self):
+    def test_select_subquery_aggregat_1(self):
         # percent users by groups
         self.execute('SET X in_group G WHERE G name "users"')
         rset = self.execute('Any GN, COUNT(X)*100/T GROUPBY GN ORDERBY 2,1'
@@ -845,6 +845,17 @@
         self.assertEquals(rset.rows, [[u'guests', 50], [u'managers', 50], [u'users', 100]])
         self.assertEquals(rset.description, [('String', 'Int'), ('String', 'Int'), ('String', 'Int')])
 
+    def test_select_subquery_aggregat_2(self):
+        expected = self.execute('Any X, 0, COUNT(T) GROUPBY X '
+                                'WHERE X is Workflow, T transition_of X').rows
+        rset = self.execute('''
+Any P1,B,E WHERE P1 identity P2 WITH
+  P1,B BEING (Any P,COUNT(T) GROUPBY P WHERE P is Workflow, T is Transition,
+              T? transition_of P, T type "auto"),
+  P2,E BEING (Any P,COUNT(T) GROUPBY P WHERE P is Workflow, T is Transition,
+              T? transition_of P, T type "normal")''')
+        self.assertEquals(sorted(rset.rows), sorted(expected))
+
     def test_select_subquery_const(self):
         rset = self.execute('Any X WITH X BEING ((Any NULL) UNION (Any "toto"))')
         self.assertEquals(rset.rows, [[None], ['toto']])