cubicweb/server/test/unittest_postgres.py
changeset 11077 09be48c01fa4
parent 11057 0b59724cb3f2
child 11257 dede32213426
--- a/cubicweb/server/test/unittest_postgres.py	Thu Jan 14 18:35:07 2016 +0100
+++ b/cubicweb/server/test/unittest_postgres.py	Thu Jan 14 17:42:22 2016 +0100
@@ -169,16 +169,16 @@
         with self.admin_access.repo_cnx() as cnx:
             def sql(string):
                 return cnx.system_sql(string).fetchone()[0]
-            yield self.assertEqual, sql("SELECT limit_size('<p>hello</p>', 'text/html', 20)"), \
-                '<p>hello</p>'
-            yield self.assertEqual, sql("SELECT limit_size('<p>hello</p>', 'text/html', 2)"), \
-                'he...'
-            yield self.assertEqual, sql("SELECT limit_size('<br/>hello', 'text/html', 2)"), \
-                'he...'
-            yield self.assertEqual, sql("SELECT limit_size('<span class=\"1\">he</span>llo', 'text/html', 2)"), \
-                'he...'
-            yield self.assertEqual, sql("SELECT limit_size('<span>a>b</span>', 'text/html', 2)"), \
-                'a>...'
+            for html, size, expected in [
+                ('<p>hello</p>', 20, '<p>hello</p>'),
+                ('<p>hello</p>', 2, 'he...'),
+                ('<br/>hello', 2, 'he...'),
+                ('<span class=\"1\">he</span>llo', 2, 'he...'),
+                ('<span>a>b</span>', 2, 'a>...'),
+            ]:
+                with self.subTest(html=html, size=size):
+                    actual = sql("SELECT limit_size('%s', 'text/html', %d)" % (html, size))
+                    self.assertEqual(actual, expected)
 
 
 if __name__ == '__main__':