author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Thu, 28 Aug 2014 18:31:18 +0200 | |
changeset 9969 | 0f64ef873f7a |
parent 9850 | 5ef9dd383ae2 |
child 10600 | 180aa08cad48 |
permissions | -rw-r--r-- |
0 | 1 |
# -*- coding: iso-8859-1 -*- |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
2 |
# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4766
diff
changeset
|
3 |
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4766
diff
changeset
|
4 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4766
diff
changeset
|
5 |
# This file is part of CubicWeb. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4766
diff
changeset
|
6 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4766
diff
changeset
|
7 |
# CubicWeb is free software: you can redistribute it and/or modify it under the |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4766
diff
changeset
|
8 |
# terms of the GNU Lesser General Public License as published by the Free |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4766
diff
changeset
|
9 |
# Software Foundation, either version 2.1 of the License, or (at your option) |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4766
diff
changeset
|
10 |
# any later version. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4766
diff
changeset
|
11 |
# |
5424
8ecbcbff9777
replace logilab-common by CubicWeb in disclaimer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5421
diff
changeset
|
12 |
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4766
diff
changeset
|
13 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4766
diff
changeset
|
14 |
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4766
diff
changeset
|
15 |
# details. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4766
diff
changeset
|
16 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4766
diff
changeset
|
17 |
# You should have received a copy of the GNU Lesser General Public License along |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4766
diff
changeset
|
18 |
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
6632 | 19 |
"""unit tests for modules cubicweb.server.rqlannotation""" |
0 | 20 |
|
7522
6f6b334a14b7
[test] update to new db handler api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
21 |
from cubicweb.devtools import TestServerConfiguration, get_test_db_handler |
0 | 22 |
from cubicweb.devtools.repotest import BaseQuerierTC |
23 |
||
24 |
class SQLGenAnnotatorTC(BaseQuerierTC): |
|
6631
26c303c3f1aa
[test] make test independant from the working directory
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6340
diff
changeset
|
25 |
|
26c303c3f1aa
[test] make test independant from the working directory
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6340
diff
changeset
|
26 |
def setUp(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
27 |
handler = get_test_db_handler(TestServerConfiguration( |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
28 |
'data2', apphome=SQLGenAnnotatorTC.datadir)) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
29 |
handler.build_db_cache() |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
30 |
repo, _cnx = handler.get_repo_and_cnx() |
6631
26c303c3f1aa
[test] make test independant from the working directory
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6340
diff
changeset
|
31 |
self.__class__.repo = repo |
26c303c3f1aa
[test] make test independant from the working directory
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6340
diff
changeset
|
32 |
super(SQLGenAnnotatorTC, self).setUp() |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
33 |
|
0 | 34 |
def get_max_eid(self): |
35 |
# no need for cleanup here |
|
36 |
return None |
|
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
37 |
|
0 | 38 |
def cleanup(self): |
39 |
# no need for cleanup here |
|
40 |
pass |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
41 |
|
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
42 |
def test_0_1(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
43 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
44 |
rqlst = self._prepare(cnx, 'Any SEN,RN,OEN WHERE X from_entity SE, ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
45 |
'SE eid 44, X relation_type R, R eid 139, ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
46 |
'X to_entity OE, OE eid 42, R name RN, SE name SEN, ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
47 |
'OE name OEN') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
48 |
self.assertEqual(rqlst.defined_vars['SE']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
49 |
self.assertEqual(rqlst.defined_vars['OE']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
50 |
self.assertEqual(rqlst.defined_vars['R']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
51 |
self.assertEqual(rqlst.defined_vars['SE'].stinfo['attrvar'], None) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
52 |
self.assertEqual(rqlst.defined_vars['OE'].stinfo['attrvar'], None) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
53 |
self.assertEqual(rqlst.defined_vars['R'].stinfo['attrvar'], None) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
54 |
|
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
55 |
def test_0_2(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
56 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
57 |
rqlst = self._prepare(cnx, 'Any O WHERE NOT S ecrit_par O, S eid 1, ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
58 |
'S inline1 P, O inline2 P') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
59 |
self.assertEqual(rqlst.defined_vars['P']._q_invariant, True) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
60 |
self.assertEqual(rqlst.defined_vars['O'].stinfo['attrvar'], None) |
0 | 61 |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
62 |
def test_0_4(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
63 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
64 |
rqlst = self._prepare(cnx, 'Any A,B,C WHERE A eid 12,A comment B, ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
65 |
'A ?wf_info_for C') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
66 |
self.assertEqual(rqlst.defined_vars['A']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
67 |
self.assert_(rqlst.defined_vars['B'].stinfo['attrvar']) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
68 |
self.assertEqual(rqlst.defined_vars['C']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
69 |
self.assertEqual(rqlst.solutions, [{'A': 'TrInfo', 'B': 'String', 'C': 'Affaire'}, |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
70 |
{'A': 'TrInfo', 'B': 'String', 'C': 'CWUser'}, |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
71 |
{'A': 'TrInfo', 'B': 'String', 'C': 'Note'}]) |
0 | 72 |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
73 |
def test_0_5(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
74 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
75 |
rqlst = self._prepare(cnx, 'Any P WHERE N ecrit_par P, N eid 0') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
76 |
self.assertEqual(rqlst.defined_vars['N']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
77 |
self.assertEqual(rqlst.defined_vars['P']._q_invariant, True) |
0 | 78 |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
79 |
def test_0_6(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
80 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
81 |
rqlst = self._prepare(cnx, 'Any P WHERE NOT N ecrit_par P, N eid 512') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
82 |
self.assertEqual(rqlst.defined_vars['P']._q_invariant, False) |
0 | 83 |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
84 |
def test_0_7(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
85 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
86 |
rqlst = self._prepare(cnx, 'Personne X,Y where X nom NX, ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
87 |
'Y nom NX, X eid XE, not Y eid XE') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
88 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
89 |
self.assertEqual(rqlst.defined_vars['Y']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
90 |
self.assert_(rqlst.defined_vars['XE'].stinfo['attrvar']) |
0 | 91 |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
92 |
def test_0_8(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
93 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
94 |
rqlst = self._prepare(cnx, 'Any P WHERE X eid 0, NOT X connait P') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
95 |
self.assertEqual(rqlst.defined_vars['P']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
96 |
#self.assertEqual(rqlst.defined_vars['X']._q_invariant, True) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
97 |
self.assertEqual(len(rqlst.solutions), 1, rqlst.solutions) |
0 | 98 |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
99 |
def test_0_10(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
100 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
101 |
rqlst = self._prepare(cnx, 'Any X WHERE X concerne Y, Y is Note') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
102 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, True) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
103 |
self.assertEqual(rqlst.defined_vars['Y']._q_invariant, False) |
0 | 104 |
|
105 |
def test_0_11(self): |
|
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
106 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
107 |
rqlst = self._prepare(cnx, 'Any X WHERE X todo_by Y, X is Affaire') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
108 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
109 |
self.assertEqual(rqlst.defined_vars['Y']._q_invariant, True) |
0 | 110 |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
111 |
def test_0_12(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
112 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
113 |
rqlst = self._prepare(cnx, 'Personne P WHERE P concerne A, ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
114 |
'A concerne S, S nom "Logilab"') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
115 |
self.assertEqual(rqlst.defined_vars['P']._q_invariant, True) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
116 |
self.assertEqual(rqlst.defined_vars['A']._q_invariant, True) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
117 |
self.assertEqual(rqlst.defined_vars['S']._q_invariant, False) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
118 |
|
0 | 119 |
def test_1_0(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
120 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
121 |
rqlst = self._prepare(cnx, 'Any X,Y WHERE X created_by Y, ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
122 |
'X eid 5, NOT Y eid 6') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
123 |
self.assertEqual(rqlst.defined_vars['Y']._q_invariant, True) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
124 |
|
0 | 125 |
def test_1_1(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
126 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
127 |
rqlst = self._prepare(cnx, 'Any X,Y WHERE X created_by Y, X eid 5, ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
128 |
'NOT Y eid IN (6,7)') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
129 |
self.assertEqual(rqlst.defined_vars['Y']._q_invariant, True) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
130 |
|
0 | 131 |
def test_2(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
132 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
133 |
rqlst = self._prepare(cnx, 'Any X WHERE X identity Y, Y eid 1') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
134 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, False) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
135 |
|
0 | 136 |
def test_7(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
137 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
138 |
rqlst = self._prepare(cnx, 'Personne X,Y where X nom NX, Y nom NX, ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
139 |
'X eid XE, not Y eid XE') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
140 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
141 |
self.assertEqual(rqlst.defined_vars['Y']._q_invariant, False) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
142 |
|
5173
73760bbb66bd
[rql annotation] add test and fix for bug introduced by 5004:4cc020ee70e2. While it sounded good, it wasn't because stinfo['relations'] didn't include anymore stinfo['typerels']
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4766
diff
changeset
|
143 |
def test_8(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
144 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
145 |
# DISTINCT Any P WHERE P require_group %(g)s, |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
146 |
# NOT %(u)s has_group_permission P, P is CWPermission |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
147 |
rqlst = self._prepare(cnx, 'DISTINCT Any X WHERE A concerne X, ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
148 |
'NOT N migrated_from X, ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
149 |
'X is Note, N eid 1') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
150 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, False) |
5173
73760bbb66bd
[rql annotation] add test and fix for bug introduced by 5004:4cc020ee70e2. While it sounded good, it wasn't because stinfo['relations'] didn't include anymore stinfo['typerels']
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4766
diff
changeset
|
151 |
|
3249
280080eadb22
fix rqlannotation bug w/ identity relation in subscope
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
152 |
def test_diff_scope_identity_deamb(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
153 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
154 |
rqlst = self._prepare(cnx, 'Any X WHERE X concerne Y, Y is Note, ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
155 |
'EXISTS(Y identity Z, Z migrated_from N)') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
156 |
self.assertEqual(rqlst.defined_vars['Z']._q_invariant, True) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
157 |
self.assertEqual(rqlst.defined_vars['Y']._q_invariant, True) |
3249
280080eadb22
fix rqlannotation bug w/ identity relation in subscope
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
158 |
|
0 | 159 |
def test_optional_inlined(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
160 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
161 |
rqlst = self._prepare(cnx, 'Any X,S where X from_state S?') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
162 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
163 |
self.assertEqual(rqlst.defined_vars['S']._q_invariant, True) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
164 |
|
0 | 165 |
def test_optional_inlined_2(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
166 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
167 |
rqlst = self._prepare(cnx, 'Any N,A WHERE N? inline1 A') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
168 |
self.assertEqual(rqlst.defined_vars['N']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
169 |
self.assertEqual(rqlst.defined_vars['A']._q_invariant, False) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
170 |
|
0 | 171 |
def test_optional_1(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
172 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
173 |
rqlst = self._prepare(cnx, 'Any X,S WHERE X travaille S?') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
174 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
175 |
self.assertEqual(rqlst.defined_vars['S']._q_invariant, True) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
176 |
|
0 | 177 |
def test_greater_eid(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
178 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
179 |
rqlst = self._prepare(cnx, 'Any X WHERE X eid > 5') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
180 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, True) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
181 |
|
0 | 182 |
def test_greater_eid_typed(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
183 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
184 |
rqlst = self._prepare(cnx, 'Any X WHERE X eid > 5, X is Note') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
185 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, True) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
186 |
|
0 | 187 |
def test_max_eid(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
188 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
189 |
rqlst = self._prepare(cnx, 'Any MAX(X)') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
190 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, True) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
191 |
|
0 | 192 |
def test_max_eid_typed(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
193 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
194 |
rqlst = self._prepare(cnx, 'Any MAX(X) WHERE X is Note') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
195 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, False) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
196 |
|
0 | 197 |
def test_all_entities(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
198 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
199 |
rqlst = self._prepare(cnx, 'Any X') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
200 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, True) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
201 |
|
0 | 202 |
def test_all_typed_entity(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
203 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
204 |
rqlst = self._prepare(cnx, 'Any X WHERE X is Note') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
205 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, False) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
206 |
|
0 | 207 |
def test_has_text_1(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
208 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
209 |
rqlst = self._prepare(cnx, 'Any X WHERE X has_text "toto tata"') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
210 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, True) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
211 |
self.assertEqual(rqlst.defined_vars['X'].stinfo['principal'].r_type, |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
212 |
'has_text') |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
213 |
|
0 | 214 |
def test_has_text_2(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
215 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
216 |
rqlst = self._prepare(cnx, 'Any X WHERE X is Personne, ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
217 |
'X has_text "coucou"') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
218 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, True) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
219 |
self.assertEqual(rqlst.defined_vars['X'].stinfo['principal'].r_type, |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
220 |
'has_text') |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
221 |
|
0 | 222 |
def test_not_relation_1(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
223 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
224 |
# P can't be invariant since deambiguification caused by "NOT X require_permission P" |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
225 |
# is not considered by generated sql (NOT EXISTS(...)) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
226 |
rqlst = self._prepare(cnx, 'Any P,G WHERE P require_group G, ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
227 |
'NOT X require_permission P') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
228 |
self.assertEqual(rqlst.defined_vars['P']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
229 |
self.assertEqual(rqlst.defined_vars['G']._q_invariant, True) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
230 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, True) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
231 |
|
0 | 232 |
def test_not_relation_2(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
233 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
234 |
rqlst = self._prepare(cnx, 'TrInfo X WHERE X eid 2, ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
235 |
'NOT X from_state Y, Y is State') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
236 |
self.assertEqual(rqlst.defined_vars['Y']._q_invariant, True) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
237 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, False) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
238 |
|
0 | 239 |
def test_not_relation_3(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
240 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
241 |
rqlst = self._prepare(cnx, 'Any X, Y WHERE X eid 1, Y eid in (2, 3)') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
242 |
self.assertEqual(rqlst.defined_vars['Y']._q_invariant, False) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
243 |
|
0 | 244 |
def test_not_relation_4_1(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
245 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
246 |
rqlst = self._prepare(cnx, 'Note X WHERE NOT Y evaluee X') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
247 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
248 |
self.assertEqual(rqlst.defined_vars['Y']._q_invariant, True) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
249 |
|
0 | 250 |
def test_not_relation_4_2(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
251 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
252 |
rqlst = self._prepare(cnx, 'Any X WHERE NOT Y evaluee X') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
253 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
254 |
self.assertEqual(rqlst.defined_vars['Y']._q_invariant, True) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
255 |
|
0 | 256 |
def test_not_relation_4_3(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
257 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
258 |
rqlst = self._prepare(cnx, 'Any Y WHERE NOT Y evaluee X') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
259 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, True) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
260 |
self.assertEqual(rqlst.defined_vars['Y']._q_invariant, False) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
261 |
|
0 | 262 |
def test_not_relation_4_4(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
263 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
264 |
rqlst = self._prepare(cnx, 'Any X WHERE NOT Y evaluee X, Y is CWUser') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
265 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
266 |
self.assertEqual(rqlst.defined_vars['Y']._q_invariant, False) |
0 | 267 |
|
268 |
def test_not_relation_4_5(self): |
|
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
269 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
270 |
rqlst = self._prepare(cnx, 'Any X WHERE NOT Y evaluee X, ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
271 |
'Y eid %s, X is Note' % self.ueid) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
272 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
273 |
self.assertEqual(rqlst.solutions, [{'X': 'Note'}]) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
274 |
|
0 | 275 |
def test_not_relation_5_1(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
276 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
277 |
rqlst = self._prepare(cnx, 'Any X,Y WHERE X name "CWGroup", ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
278 |
'Y eid IN(1, 2, 3), NOT X read_permission Y') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
279 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
280 |
self.assertEqual(rqlst.defined_vars['Y']._q_invariant, False) |
0 | 281 |
|
282 |
def test_not_relation_5_2(self): |
|
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
283 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
284 |
rqlst = self._prepare(cnx, 'DISTINCT Any X,Y WHERE X name "CWGroup", ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
285 |
'Y eid IN(1, 2, 3), NOT X read_permission Y') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
286 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
287 |
self.assertEqual(rqlst.defined_vars['Y']._q_invariant, False) |
0 | 288 |
|
289 |
def test_not_relation_6(self): |
|
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
290 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
291 |
rqlst = self._prepare(cnx, 'Personne P where NOT P concerne A') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
292 |
self.assertEqual(rqlst.defined_vars['P']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
293 |
self.assertEqual(rqlst.defined_vars['A']._q_invariant, True) |
0 | 294 |
|
295 |
def test_not_relation_7(self): |
|
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
296 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
297 |
rqlst = self._prepare(cnx, 'Any K,V WHERE P is CWProperty, ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
298 |
'P pkey K, P value V, NOT P for_user U') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
299 |
self.assertEqual(rqlst.defined_vars['P']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
300 |
self.assertEqual(rqlst.defined_vars['U']._q_invariant, True) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
301 |
|
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
302 |
def test_exists_1(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
303 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
304 |
rqlst = self._prepare(cnx, 'Any U WHERE U eid IN (1,2), EXISTS(X owned_by U)') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
305 |
self.assertEqual(rqlst.defined_vars['U']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
306 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, True) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
307 |
|
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
308 |
def test_exists_2(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
309 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
310 |
rqlst = self._prepare(cnx, 'Any U WHERE EXISTS(U eid IN (1,2), X owned_by U)') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
311 |
self.assertEqual(rqlst.defined_vars['U']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
312 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, True) |
0 | 313 |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
314 |
def test_exists_3(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
315 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
316 |
rqlst = self._prepare(cnx, 'Any U WHERE EXISTS(X owned_by U, X bookmarked_by U)') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
317 |
self.assertEqual(rqlst.defined_vars['U']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
318 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, True) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
319 |
|
0 | 320 |
def test_exists_4(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
321 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
322 |
rqlst = self._prepare(cnx, 'Any X,Y WHERE X name "CWGroup", ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
323 |
'Y eid IN(1, 2, 3), EXISTS(X read_permission Y)') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
324 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
325 |
self.assertEqual(rqlst.defined_vars['Y']._q_invariant, False) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
326 |
|
0 | 327 |
def test_exists_5(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
328 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
329 |
rqlst = self._prepare(cnx, 'DISTINCT Any X,Y WHERE X name "CWGroup", ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
330 |
'Y eid IN(1, 2, 3), EXISTS(X read_permission Y)') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
331 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
332 |
self.assertEqual(rqlst.defined_vars['Y']._q_invariant, True) |
0 | 333 |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
334 |
def test_not_exists_1(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
335 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
336 |
rqlst = self._prepare(cnx, 'Any U WHERE NOT EXISTS(X owned_by U, ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
337 |
'X bookmarked_by U)') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
338 |
self.assertEqual(rqlst.defined_vars['U']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
339 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, True) |
0 | 340 |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
341 |
def test_not_exists_2(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
342 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
343 |
rqlst = self._prepare(cnx, 'Any X,Y WHERE X name "CWGroup", ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
344 |
'Y eid IN(1, 2, 3), NOT EXISTS(X read_permission Y)') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
345 |
self.assertEqual(rqlst.defined_vars['Y']._q_invariant, False) |
0 | 346 |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
347 |
def test_not_exists_distinct_1(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
348 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
349 |
rqlst = self._prepare(cnx, 'DISTINCT Any X,Y WHERE X name "CWGroup", ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
350 |
'Y eid IN(1, 2, 3), NOT EXISTS(X read_permission Y)') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
351 |
self.assertEqual(rqlst.defined_vars['Y']._q_invariant, False) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
352 |
|
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
353 |
def test_or_1(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
354 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
355 |
rqlst = self._prepare(cnx, 'Any X WHERE X concerne B OR ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
356 |
'C concerne X, B eid 12, C eid 13') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
357 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, False) |
0 | 358 |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
359 |
def test_or_2(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
360 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
361 |
rqlst = self._prepare(cnx, 'Any X WHERE X created_by U, X concerne B OR ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
362 |
'C concerne X, B eid 12, C eid 13') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
363 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, True) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
364 |
self.assertEqual(rqlst.defined_vars['U']._q_invariant, True) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
365 |
self.assertEqual(rqlst.defined_vars['X'].stinfo['principal'].r_type, 'created_by') |
0 | 366 |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
367 |
def test_or_3(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
368 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
369 |
rqlst = self._prepare(cnx, 'Any N WHERE A evaluee N or EXISTS(N todo_by U)') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
370 |
self.assertEqual(rqlst.defined_vars['N']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
371 |
self.assertEqual(rqlst.defined_vars['A']._q_invariant, True) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
372 |
self.assertEqual(rqlst.defined_vars['U']._q_invariant, True) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
373 |
|
0 | 374 |
def test_or_exists_1(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
375 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
376 |
# query generated by security rewriting |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
377 |
rqlst = self._prepare(cnx, 'DISTINCT Any A,S WHERE A is Affaire, S nom "chouette", ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
378 |
'S is IN(Division, Societe, SubDivision),' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
379 |
'(EXISTS(A owned_by D)) ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
380 |
'OR ((((EXISTS(E concerne C?, C owned_by D, A identity E, ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
381 |
' C is Note, E is Affaire)) ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
382 |
'OR (EXISTS(I concerne H?, H owned_by D, H is Societe, ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
383 |
' A identity I, I is Affaire))) ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
384 |
'OR (EXISTS(J concerne G?, G owned_by D, G is SubDivision, ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
385 |
' A identity J, J is Affaire))) ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
386 |
'OR (EXISTS(K concerne F?, F owned_by D, F is Division, ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
387 |
' A identity K, K is Affaire)))') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
388 |
self.assertEqual(rqlst.defined_vars['A']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
389 |
self.assertEqual(rqlst.defined_vars['S']._q_invariant, False) |
0 | 390 |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
391 |
def test_or_exists_2(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
392 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
393 |
rqlst = self._prepare(cnx, 'Any U WHERE EXISTS(U in_group G, G name "managers") OR ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
394 |
'EXISTS(X owned_by U, X bookmarked_by U)') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
395 |
self.assertEqual(rqlst.defined_vars['U']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
396 |
self.assertEqual(rqlst.defined_vars['G']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
397 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, True) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
398 |
|
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
399 |
def test_or_exists_3(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
400 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
401 |
rqlst = self._prepare(cnx, 'Any COUNT(S),CS GROUPBY CS ORDERBY 1 DESC LIMIT 10 ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
402 |
'WHERE C is Societe, S concerne C, C nom CS, ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
403 |
'(EXISTS(S owned_by D)) OR (EXISTS(S documented_by N, N title "published"))') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
404 |
self.assertEqual(rqlst.defined_vars['S']._q_invariant, True) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
405 |
rqlst = self._prepare(cnx, 'Any COUNT(S),CS GROUPBY CS ORDERBY 1 DESC LIMIT 10 ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
406 |
'WHERE S is Affaire, C is Societe, S concerne C, C nom CS, ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
407 |
'(EXISTS(S owned_by D)) OR (EXISTS(S documented_by N, N title "published"))') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
408 |
self.assertEqual(rqlst.defined_vars['S']._q_invariant, True) |
0 | 409 |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
410 |
def test_nonregr_ambiguity(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
411 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
412 |
rqlst = self._prepare(cnx, 'Note N WHERE N attachment F') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
413 |
# N may be an image as well, not invariant |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
414 |
self.assertEqual(rqlst.defined_vars['N']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
415 |
self.assertEqual(rqlst.defined_vars['F']._q_invariant, True) |
967 | 416 |
|
7523
f6856231cc51
[rql annotation] fix bad invariant variable w/ has_text relation: this is only true when has_text will be used as principal (though we don't know that yet)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7522
diff
changeset
|
417 |
def test_nonregr_ambiguity_2(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
418 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
419 |
rqlst = self._prepare(cnx, 'Any S,SN WHERE X has_text "tot", X in_state S, S name SN, X is CWUser') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
420 |
# X use has_text but should not be invariant as ambiguous, and has_text |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
421 |
# may not be its principal |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
422 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
423 |
self.assertEqual(rqlst.defined_vars['S']._q_invariant, False) |
7523
f6856231cc51
[rql annotation] fix bad invariant variable w/ has_text relation: this is only true when has_text will be used as principal (though we don't know that yet)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7522
diff
changeset
|
424 |
|
7651
7c0af7ef3325
[repo, ms] fix planning of some queries where variable 'non-invarianess' should be considered, leading for instance to junk in entities table on source deletion
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7523
diff
changeset
|
425 |
def test_remove_from_deleted_source_1(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
426 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
427 |
rqlst = self._prepare(cnx, 'Note X WHERE X eid 999998, NOT X cw_source Y') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
428 |
self.assertNotIn('X', rqlst.defined_vars) # simplified |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
429 |
self.assertEqual(rqlst.defined_vars['Y']._q_invariant, True) |
7651
7c0af7ef3325
[repo, ms] fix planning of some queries where variable 'non-invarianess' should be considered, leading for instance to junk in entities table on source deletion
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7523
diff
changeset
|
430 |
|
7c0af7ef3325
[repo, ms] fix planning of some queries where variable 'non-invarianess' should be considered, leading for instance to junk in entities table on source deletion
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7523
diff
changeset
|
431 |
def test_remove_from_deleted_source_2(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
432 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
433 |
rqlst = self._prepare(cnx, 'Note X WHERE X eid IN (999998, 999999), NOT X cw_source Y') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
434 |
self.assertEqual(rqlst.defined_vars['X']._q_invariant, False) |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
435 |
self.assertEqual(rqlst.defined_vars['Y']._q_invariant, True) |
8342
7a5271182ef0
[rql annotation] fix has_text_query detection (if coming from sub-query and if has_text on a column aliases. Closes #2275322
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7791
diff
changeset
|
436 |
|
7a5271182ef0
[rql annotation] fix has_text_query detection (if coming from sub-query and if has_text on a column aliases. Closes #2275322
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7791
diff
changeset
|
437 |
def test_has_text_security_cache_bug(self): |
9850
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
438 |
with self.session.new_cnx() as cnx: |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
439 |
rqlst = self._prepare(cnx, 'Any X WHERE X has_text "toto" WITH X BEING ' |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
440 |
'(Any C WHERE C is Societe, C nom CS)') |
5ef9dd383ae2
[tests/rqlannotation,querier] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9675
diff
changeset
|
441 |
self.assertTrue(rqlst.parent.has_text_query) |
8342
7a5271182ef0
[rql annotation] fix has_text_query detection (if coming from sub-query and if has_text on a column aliases. Closes #2275322
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7791
diff
changeset
|
442 |
|
0 | 443 |
if __name__ == '__main__': |
444 |
from logilab.common.testlib import unittest_main |
|
445 |
unittest_main() |