server/test/unittest_querier.py
changeset 10591 8e46ed1a0b8a
parent 10508 2a578b9e7ad8
child 10600 180aa08cad48
equal deleted inserted replaced
10590:7629902e7554 10591:8e46ed1a0b8a
    19 """unit tests for modules cubicweb.server.querier and cubicweb.server.ssplanner
    19 """unit tests for modules cubicweb.server.querier and cubicweb.server.ssplanner
    20 """
    20 """
    21 
    21 
    22 from datetime import date, datetime, timedelta, tzinfo
    22 from datetime import date, datetime, timedelta, tzinfo
    23 
    23 
       
    24 from six import PY2
    24 from logilab.common.testlib import TestCase, unittest_main
    25 from logilab.common.testlib import TestCase, unittest_main
    25 from rql import BadRQLQuery, RQLSyntaxError
    26 from rql import BadRQLQuery, RQLSyntaxError
    26 
    27 
    27 from cubicweb import QueryError, Unauthorized, Binary
    28 from cubicweb import QueryError, Unauthorized, Binary
    28 from cubicweb.server.sqlutils import SQL_PREFIX
    29 from cubicweb.server.sqlutils import SQL_PREFIX
   261         self.assertEqual(rset.description[0][0], 'Date')
   262         self.assertEqual(rset.description[0][0], 'Date')
   262         rset = self.qexecute('Any NOW')
   263         rset = self.qexecute('Any NOW')
   263         self.assertEqual(rset.description[0][0], 'Datetime')
   264         self.assertEqual(rset.description[0][0], 'Datetime')
   264         rset = self.qexecute('Any %(x)s', {'x': 1})
   265         rset = self.qexecute('Any %(x)s', {'x': 1})
   265         self.assertEqual(rset.description[0][0], 'Int')
   266         self.assertEqual(rset.description[0][0], 'Int')
   266         rset = self.qexecute('Any %(x)s', {'x': 1L})
   267         if PY2:
   267         self.assertEqual(rset.description[0][0], 'Int')
   268             rset = self.qexecute('Any %(x)s', {'x': long(1)})
       
   269             self.assertEqual(rset.description[0][0], 'Int')
   268         rset = self.qexecute('Any %(x)s', {'x': True})
   270         rset = self.qexecute('Any %(x)s', {'x': True})
   269         self.assertEqual(rset.description[0][0], 'Boolean')
   271         self.assertEqual(rset.description[0][0], 'Boolean')
   270         rset = self.qexecute('Any %(x)s', {'x': 1.0})
   272         rset = self.qexecute('Any %(x)s', {'x': 1.0})
   271         self.assertEqual(rset.description[0][0], 'Float')
   273         self.assertEqual(rset.description[0][0], 'Float')
   272         rset = self.qexecute('Any %(x)s', {'x': datetime.now()})
   274         rset = self.qexecute('Any %(x)s', {'x': datetime.now()})