From d6ebcdd0986f9d4e6a08a77f1879aef628a3af9b Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 14 Nov 2024 11:21:22 +0100 Subject: [PATCH] Tests - assert single values in tables --- test_manager/utils_test.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test_manager/utils_test.py b/test_manager/utils_test.py index 2f6e8035..cf92a727 100644 --- a/test_manager/utils_test.py +++ b/test_manager/utils_test.py @@ -18,6 +18,13 @@ FLASK_APP = None +def _compare_rows(rows_res, rows_exp): + assert len(rows_res) == len(rows_exp) + for row_idx, row_res in enumerate(rows_res): + row_res_str = [str(x)[:10] for x in row_res] + row_exp_str = [str(x)[:10] for x in rows_exp[row_idx]] + assert row_res_str == row_exp_str + def compare_tables(tables_res, tables_exp): assert len(tables_res) == len(tables_exp) for idx, table_res in enumerate(tables_res): @@ -25,11 +32,7 @@ def compare_tables(tables_res, tables_exp): for key, value_res in table_res['metadata'].items(): assert value_res == tables_exp[idx]['metadata'][key] assert table_res['columns'] == tables_exp[idx]['columns'] - assert len(table_res['rows']) == len(tables_exp[idx]['rows']) - for row_idx, row_res in enumerate(table_res['rows']): - row_res_str = [str(x)[:10] for x in row_res] - row_exp_str = [str(x)[:10] for x in tables_exp[idx]['rows'][row_idx]] - assert row_res_str == row_exp_str + _compare_rows(table_res['rows'],tables_exp[idx]['rows']) def compare_reader_result(src_path, res_path, file):