test/unittest_rset.py
branchstable
changeset 8085 51929d531aff
parent 8048 10a0f73d834d
child 8087 dc788369d35f
equal deleted inserted replaced
8081:e8091b415ad8 8085:51929d531aff
    68                '(Any YEAR(CD), MONTH(CD), S, X WHERE X is CWUser, X creation_date CD, X in_state S)')
    68                '(Any YEAR(CD), MONTH(CD), S, X WHERE X is CWUser, X creation_date CD, X in_state S)')
    69         rqlst = parse(rql)
    69         rqlst = parse(rql)
    70         select, col = rqlst.locate_subquery(2, 'CWUser', None)
    70         select, col = rqlst.locate_subquery(2, 'CWUser', None)
    71         result = list(attr_desc_iterator(select, col, 2))
    71         result = list(attr_desc_iterator(select, col, 2))
    72         self.assertEqual(result, [])
    72         self.assertEqual(result, [])
       
    73 
       
    74     def test_subquery_callfunc_2(self):
       
    75         rql = ('Any X,S,L WHERE X in_state S WITH X, L BEING (Any X,MAX(L) GROUPBY X WHERE X is CWUser, T wf_info_for X, T creation_date L)')
       
    76         rqlst = parse(rql)
       
    77         select, col = rqlst.locate_subquery(0, 'CWUser', None)
       
    78         result = list(attr_desc_iterator(select, col, 0))
       
    79         self.assertEqual(result, [(1, 'in_state', 'subject')])
    73 
    80 
    74 
    81 
    75 class ResultSetTC(CubicWebTC):
    82 class ResultSetTC(CubicWebTC):
    76 
    83 
    77     def setUp(self):
    84     def setUp(self):
   477 
   484 
   478         rset = self.execute('(Any X WHERE X is CWGroup, X name "managers")')
   485         rset = self.execute('(Any X WHERE X is CWGroup, X name "managers")')
   479         self.assertIsInstance(str(rset), basestring)
   486         self.assertIsInstance(str(rset), basestring)
   480         self.assertEqual(len(str(rset).splitlines()), 1)
   487         self.assertEqual(len(str(rset).splitlines()), 1)
   481 
   488 
       
   489 
   482 if __name__ == '__main__':
   490 if __name__ == '__main__':
   483     unittest_main()
   491     unittest_main()