symmetric relations: replace bogus rql2sql translation by a hook
The hook ensures X r Y => Y r X iff r is symmetric.
The rql-no-hook data importer receives a small amendment but note
that:
* there exist no test for it
* its actual semantics are undefined
Hence we cannot prove this hunk breaks nothing, because we cannot
prove anything.
Closes #3259713.
# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr## This file is part of CubicWeb.## CubicWeb is free software: you can redistribute it and/or modify it under the# terms of the GNU Lesser General Public License as published by the Free# Software Foundation, either version 2.1 of the License, or (at your option)# any later version.## CubicWeb is distributed in the hope that it will be useful, but WITHOUT# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more# details.## You should have received a copy of the GNU Lesser General Public License along# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.""""""fromlogilab.common.testlibimportTestCase,unittest_mainimportcubicwebfsimportsredefspec_parser(filename):""" extract tests from specification """sections=[]buffer=""in_section=Falseforlineinfile(filename):ifline.startswith('Test::'):in_section=Truebuffer=""elifin_section:ifline.startswith(" ")ornotline.strip():buffer+=line.lstrip()else:sections.append(buffer)in_section=Falsetests=[]forsectioninsections:subsections=[tfortinsection.strip().split('$ ls')ift]forsubsectioninsubsections:path,results=subsection.splitlines()[0],subsection.splitlines()[1:]path=path.strip()items=set([iforiinsre.split('[\t\n]','\n'.join(results))ifi])tests.append((path,items))returnteststests=spec_parser("cubicwebfs-spec.txt")classmonTC(TestCase):passforindex,(path,results)inenumerate(tests):deff(self,p=path,r=results):res=set(cubicwebfs.ls(p))self.assertEqual(r,res)#, 'en trop %s\nmanque %s' % (r-results,results-r))f.__doc__="%s%s"%(index,path)setattr(monTC,'test_%s'%index,f)if__name__=='__main__':unittest_main()