我有一个比较两个python函数的单元测试。
我想知道如何在网格中返回这些单元测试的输出
import unittest
class TestExample(unittest.TestCase):
def test_queries(self):
self.assertEqual(q1(), q2())
if __name__ == '__main__':
unittest.main()
要比较的功能:
def q1():
dwh_connection = psycopg2.connect(db_details)
cur = dwh_connection.cursor()
cur.execute("""select count(*) from table_1""")
result = cur.fetchall()
print(result)
dwh_connection.close()
return result
def q2():
dwh_connection = psycopg2.connect(db_details)
cur = dwh_connection.cursor()
cur.execute("""select count(*) from table_2""")
result = cur.fetchall()
print(result)
dwh_connection.close()
return result
输出:
Ran 1 test in 5.116s
OK
任何人都可以建议如何将其转换为显示为表格或网格。谢谢。