Commit 4fbadd35 authored by Julien Cristau's avatar Julien Cristau
Browse files

[rset] make sure rset.description is always a list

It's more consistent, and avoids pylint warning
"Instance of 'tuple' has no 'append' member"

--HG--
branch : stable
parent bae0caa8477a
......@@ -45,7 +45,7 @@ class ResultSet(object):
:param rql: the original RQL query string
"""
def __init__(self, results, rql, args=None, description=(), rqlst=None):
def __init__(self, results, rql, args=None, description=None, rqlst=None):
self.rows = results
self.rowcount = results and len(results) or 0
# original query and arguments
......@@ -53,7 +53,7 @@ class ResultSet(object):
self.args = args
# entity types for each cell (same shape as rows)
# maybe discarded if specified when the query has been executed
self.description = description
self.description = description or []
# parsed syntax tree
if rqlst is not None:
rqlst.schema = None # reset schema in case of pyro transfert
......
......@@ -702,7 +702,7 @@ class QuerierTC(BaseQuerierTC):
rset = self.execute('Any X WHERE X is CWGroup', build_descr=0)
rset.rows.sort()
self.assertEqual(tuplify(rset.rows), [(2,), (3,), (4,), (5,)])
self.assertEqual(rset.description, ())
self.assertEqual(rset.description, [])
def test_select_limit_offset(self):
rset = self.execute('CWGroup X ORDERBY N LIMIT 2 WHERE X name N')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment