[test rql completion] dont limit number of completion, else we've impredicable results. Also should tell rql.parse to not print error on stdout
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 02 Aug 2012 10:09:11 +0200
changeset 8510 e2913c9880a0
parent 8509 e83b4a64ba29
child 8513 552de9f0c46d
[test rql completion] dont limit number of completion, else we've impredicable results. Also should tell rql.parse to not print error on stdout This repairs test introduced by dcd9bc1d1bca which closes #2439846
web/test/unittest_magicsearch.py
web/views/magicsearch.py
--- a/web/test/unittest_magicsearch.py	Wed Aug 01 10:47:27 2012 +0200
+++ b/web/test/unittest_magicsearch.py	Thu Aug 02 10:09:11 2012 +0200
@@ -235,7 +235,6 @@
     def suggestions(self, rql):
         req = self.request()
         rbs = self.vreg['components'].select('rql.suggestions', req)
-        rbs.attr_value_limit = 10 # limit to 10 to ease vocabulry tests
         return rbs.build_suggestions(rql)
 
     def test_no_restrictions_rql(self):
@@ -319,6 +318,11 @@
             req.create_entity('Personne', nom=u'n%s' % i, prenom=u'p%s' % i)
         self.assertListEqual(['Any X WHERE X is Personne, X nom "n0"',
                               'Any X WHERE X is Personne, X nom "n1"',
+                              'Any X WHERE X is Personne, X nom "n10"',
+                              'Any X WHERE X is Personne, X nom "n11"',
+                              'Any X WHERE X is Personne, X nom "n12"',
+                              'Any X WHERE X is Personne, X nom "n13"',
+                              'Any X WHERE X is Personne, X nom "n14"',
                               'Any X WHERE X is Personne, X nom "n2"',
                               'Any X WHERE X is Personne, X nom "n3"',
                               'Any X WHERE X is Personne, X nom "n4"',
--- a/web/views/magicsearch.py	Wed Aug 01 10:47:27 2012 +0200
+++ b/web/views/magicsearch.py	Thu Aug 02 10:09:11 2012 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
 #
 # This file is part of CubicWeb.
@@ -452,7 +452,7 @@
             else:
                 restrictions, incomplete_part = '', restrictions
                 user_rql = variables
-            select = parse(user_rql).children[0]
+            select = parse(user_rql, print_errors=False).children[0]
             req.vreg.rqlhelper.annotate(select)
             req.vreg.solutions(req, select, {})
             if restrictions: