Skip to content

Commit

Permalink
Tests - assert single values in tables
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin committed Nov 14, 2024
1 parent c9c89ff commit d6ebcdd
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions test_manager/utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,21 @@

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):
assert '\n'.join(table_res['header']) == '\n'.join(tables_exp[idx]['header'])
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):
Expand Down

0 comments on commit d6ebcdd

Please sign in to comment.