Make `assert_sorted_query_result` a bit safer.
It's useful to set up a module for a bunch of `SELECT` queries as a
separate `SET MODULE test;` statement. This produces a `None` in the
results that doesn't really need to be sorted.
@@ -384,6 +384,8 @@ class BaseQueryTestCase(DatabaseTestCase):
res = await self.con.execute(query)
# sort the query result by using the supplied key
for r in res:
+ # don't bother sorting empty things
+ if r:
r.sort(key=key)
self.assert_data_shape(res, result)
return res
