server/test/unittest_rql2sql.py
changeset 5233 673b63953e7a
parent 5016 b3b0b808a0ed
child 5423 e15abfdcce38
equal deleted inserted replaced
5232:78c1a531f7b3 5233:673b63953e7a
  1207     def test_date_extraction(self):
  1207     def test_date_extraction(self):
  1208         self._check("Any MONTH(D) WHERE P is Personne, P creation_date D",
  1208         self._check("Any MONTH(D) WHERE P is Personne, P creation_date D",
  1209                     '''SELECT CAST(EXTRACT(MONTH from _P.cw_creation_date) AS INTEGER)
  1209                     '''SELECT CAST(EXTRACT(MONTH from _P.cw_creation_date) AS INTEGER)
  1210 FROM cw_Personne AS _P''')
  1210 FROM cw_Personne AS _P''')
  1211 
  1211 
       
  1212     def test_substring(self):
       
  1213         self._check("Any SUBSTRING(N, 1, 1) WHERE P nom N, P is Personne",
       
  1214                     '''SELECT SUBSTR(_P.cw_nom, 1, 1)
       
  1215 FROM cw_Personne AS _P''')
  1212 
  1216 
  1213     def test_parser_parse(self):
  1217     def test_parser_parse(self):
  1214         for t in self._parse(PARSER):
  1218         for t in self._parse(PARSER):
  1215             yield t
  1219             yield t
  1216 
  1220 
  1599                      '''SELECT _A.cw_eid, rel_todo_by1.eid_to, rel_todo_by3.eid_to, GROUP_CONCAT(_T.cw_name)
  1603                      '''SELECT _A.cw_eid, rel_todo_by1.eid_to, rel_todo_by3.eid_to, GROUP_CONCAT(_T.cw_name)
  1600 FROM concerne_relation AS rel_concerne0, cw_Affaire AS _A LEFT OUTER JOIN tags_relation AS rel_tags2 ON (rel_tags2.eid_to=_A.cw_eid) LEFT OUTER JOIN cw_Tag AS _T ON (rel_tags2.eid_from=_T.cw_eid) LEFT OUTER JOIN todo_by_relation AS rel_todo_by3 ON (rel_todo_by3.eid_from=_A.cw_eid), cw_Note AS _N LEFT OUTER JOIN todo_by_relation AS rel_todo_by1 ON (rel_todo_by1.eid_from=_N.cw_eid)
  1604 FROM concerne_relation AS rel_concerne0, cw_Affaire AS _A LEFT OUTER JOIN tags_relation AS rel_tags2 ON (rel_tags2.eid_to=_A.cw_eid) LEFT OUTER JOIN cw_Tag AS _T ON (rel_tags2.eid_from=_T.cw_eid) LEFT OUTER JOIN todo_by_relation AS rel_todo_by3 ON (rel_todo_by3.eid_from=_A.cw_eid), cw_Note AS _N LEFT OUTER JOIN todo_by_relation AS rel_todo_by1 ON (rel_todo_by1.eid_from=_N.cw_eid)
  1601 WHERE rel_concerne0.eid_from=_A.cw_eid AND rel_concerne0.eid_to=_N.cw_eid
  1605 WHERE rel_concerne0.eid_from=_A.cw_eid AND rel_concerne0.eid_to=_N.cw_eid
  1602 GROUP BY _A.cw_eid,rel_todo_by1.eid_to,rel_todo_by3.eid_to''')
  1606 GROUP BY _A.cw_eid,rel_todo_by1.eid_to,rel_todo_by3.eid_to''')
  1603 
  1607 
       
  1608     def test_substring(self):
       
  1609         self._check("Any SUBSTRING(N, 1, 1) WHERE P nom N, P is Personne",
       
  1610                     '''SELECT SUBSTRING(_P.cw_nom, 1, 1)
       
  1611 FROM cw_Personne AS _P''')
  1604 
  1612 
  1605 class removeUnsusedSolutionsTC(TestCase):
  1613 class removeUnsusedSolutionsTC(TestCase):
  1606     def test_invariant_not_varying(self):
  1614     def test_invariant_not_varying(self):
  1607         rqlst = mock_object(defined_vars={})
  1615         rqlst = mock_object(defined_vars={})
  1608         rqlst.defined_vars['A'] = mock_object(scope=rqlst, stinfo={}, _q_invariant=True)
  1616         rqlst.defined_vars['A'] = mock_object(scope=rqlst, stinfo={}, _q_invariant=True)