Commit b76338bd authored by Julien Cristau's avatar Julien Cristau
Browse files

[rset] Fix regression with rset copying (closes #3344410)

Don't override passed-in descriptions in ResultSet.__init__, even if
they're empty.

--HG--
branch : stable
parent 45e0034e2a73
......@@ -53,7 +53,10 @@ 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 or []
if description is None:
self.description = []
else:
self.description = description
# 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')
......
......@@ -181,6 +181,7 @@ class ResultSetTC(CubicWebTC):
rs2 = rs.filtered_rset(test_filter)
self.assertEqual(len(rs2), 2)
self.assertEqual([login for _, login in rs2], ['adim', 'syt'])
self.assertEqual(rs2.description, rs.description[1:])
def test_transform(self):
rs = ResultSet([[12, 'adim'], [13, 'syt'], [14, 'nico']],
......
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