equal
deleted
inserted
replaced
5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
7 """ |
7 """ |
8 from logilab.common.testlib import unittest_main, TestCase |
8 from logilab.common.testlib import unittest_main, TestCase |
9 from logilab.common.testlib import mock_object |
9 from logilab.common.testlib import mock_object |
10 |
10 from yams import BadSchemaDefinition |
11 from rql import parse, nodes, RQLHelper |
11 from rql import parse, nodes, RQLHelper |
12 |
12 |
13 from cubicweb import Unauthorized |
13 from cubicweb import Unauthorized |
14 from cubicweb.schema import RRQLExpression |
14 from cubicweb.schema import RRQLExpression |
15 from cubicweb.rqlrewrite import RQLRewriter |
15 from cubicweb.rqlrewrite import RQLRewriter |
165 # ('A', 'X'): (c2,), |
165 # ('A', 'X'): (c2,), |
166 # }, {}) |
166 # }, {}) |
167 # self.failUnlessEqual(rqlst.as_string(), |
167 # self.failUnlessEqual(rqlst.as_string(), |
168 # "") |
168 # "") |
169 |
169 |
|
170 def test_optional_var_inlined_imbricated_error(self): |
|
171 c1 = ('X require_permission P') |
|
172 c2 = ('X inlined_card O, O require_permission P') |
|
173 rqlst = parse('Any C,A,R,A2,R2 WHERE A? inlined_card C, A ref R,A2? inlined_card C, A2 ref R2') |
|
174 self.assertRaises(BadSchemaDefinition, |
|
175 rewrite, rqlst, {('C', 'X'): (c1,), |
|
176 ('A', 'X'): (c2,), |
|
177 ('A2', 'X'): (c2,), |
|
178 }, {}) |
|
179 |
170 def test_relation_optimization_1_lhs(self): |
180 def test_relation_optimization_1_lhs(self): |
171 # since Card in_state State as monovalued cardinality, the in_state |
181 # since Card in_state State as monovalued cardinality, the in_state |
172 # relation used in the rql expression can be ignored and S replaced by |
182 # relation used in the rql expression can be ignored and S replaced by |
173 # the variable from the incoming query |
183 # the variable from the incoming query |
174 snippet = ('X in_state S, S name "hop"') |
184 snippet = ('X in_state S, S name "hop"') |