[rset] make sure rset.description is always a list
It's more consistent, and avoids pylint warning
"Instance of 'tuple' has no 'append' member"
--- a/rset.py Wed Oct 09 16:30:27 2013 +0200
+++ b/rset.py Wed Oct 09 14:45:36 2013 +0200
@@ -45,7 +45,7 @@
: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 @@
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
--- a/server/test/unittest_querier.py Wed Oct 09 16:30:27 2013 +0200
+++ b/server/test/unittest_querier.py Wed Oct 09 14:45:36 2013 +0200
@@ -702,7 +702,7 @@
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')