author Philippe Pepiot <philippe.pepiot@logilab.fr>
Wed, 06 Nov 2019 11:27:36 +0100
changeset 868 3ee87bec4482
parent 861 d5e1e2b627fc
child 869 d521e746de34
permissions -rw-r--r--
Stop building python2 wheels and workaround broken py38 wheel This script is used to publish wheel binary packages to pypi. Since we're going to remove python2 support, stop generating wheels for python2. Also py38 is out and our wheel doesn't compile with py38 due to a bug of logilab-common. Waiting a fix, don't build wheel for py38. % docker run --rm -it quay.io/pypa/manylinux1_x86_64 ls -1A /opt/python cp27-cp27m cp27-cp27mu cp34-cp34m cp35-cp35m cp36-cp36m cp37-cp37m cp38-cp38

# copyright 2004-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
# This file is part of rql.
# rql 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.
# rql 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 rql. If not, see <http://www.gnu.org/licenses/>.

from six.moves import range

from logilab.common.testlib import TestCase, unittest_main

from rql import utils, nodes, parse

class Visitor(utils.RQLVisitorHandler):
    def visit(self, node):
        for c in node.children:

class RQLHandlerClassTest(TestCase):
    """tests that the default handler implements a method for each possible node

    def setUp(self):
        self.visitor = Visitor()

    def test_methods_1(self):
        tree = parse('Any X where X name "turlututu", X born <= TODAY - 2 OR X born = NULL', {})

    def test_methods_2(self):
        tree = parse('Insert Person X', {})

    def test_methods_3(self):
        tree = parse(
            'Set X nom "yo" WHERE X is Person',
            {'Person': nodes.Constant('Person', 'etype')},

    def test_methods_4(self):
        tree = parse('Delete Person X', {})

class RQLVarMakerTC(TestCase):

    def test_rqlvar_maker(self):
        varlist = list(utils.rqlvar_maker(27))
        self.assertEqual(varlist, list('ABCDEFGHIJKLMNOPQRSTUVWXYZ') + ['AA'])
        varlist = list(utils.rqlvar_maker(27*26+1))
        self.assertEqual(varlist[-2], 'ZZ')
        self.assertEqual(varlist[-1], 'AAA')

    def test_rqlvar_maker_dontstop(self):
        varlist = utils.rqlvar_maker()
        self.assertEqual(next(varlist), 'A')
        self.assertEqual(next(varlist), 'B')
        for i in range(24):
        self.assertEqual(next(varlist), 'AA')
        self.assertEqual(next(varlist), 'AB')

if __name__ == '__main__':