[py3k] import range using six.moves
authorRémi Cardona <remi.cardona@logilab.fr>
Mon, 23 Nov 2015 15:54:28 +0100
changeset 10884 8a51e160026a
parent 10883 abd1d5e36fed
child 10885 b3a192804b63
[py3k] import range using six.moves Also, use create_entity instead of hand-crafting RQL queries. Fixes regression introduced in commit 768d332de17b.
test/unittest_predicates.py
--- a/test/unittest_predicates.py	Mon Nov 09 17:17:53 2015 +0100
+++ b/test/unittest_predicates.py	Mon Nov 23 15:54:28 2015 +0100
@@ -20,6 +20,8 @@
 from operator import eq, lt, le, gt
 from contextlib import contextmanager
 
+from six.moves import range
+
 from logilab.common.testlib import TestCase, unittest_main
 from logilab.common.decorators import clear_cache
 
@@ -488,13 +490,14 @@
         self.assertEqual(str(cm.exception),
                          "match_form_params() positional arguments must be strings")
 
+
 class PaginatedTC(CubicWebTC):
     """tests for paginated_rset predicate"""
 
     def setup_database(self):
         with self.admin_access.repo_cnx() as cnx:
-            for i in xrange(30):
-                cnx.execute('INSERT CWGroup G: G name "group{}"'.format(i))
+            for i in range(30):
+                cnx.create_entity('CWGroup', name="group%d" % i)
             cnx.commit()
 
     def test_paginated_rset(self):
@@ -516,6 +519,7 @@
         with web_request(vid='list', page_size='not_an_int') as req:
             self.assertEqual(paginated_rset()(None, req, rset), 0)
 
+
 if __name__ == '__main__':
     unittest_main()