diff --git a/unittests/table_json_conversion/test_read_data.py b/unittests/table_json_conversion/test_read_data.py index b5dcafc7b433446e311dae6f409b3d7772e1a08e..76f9c03f529472add985589c2c971ec63a8480de 100644 --- a/unittests/table_json_conversion/test_read_data.py +++ b/unittests/table_json_conversion/test_read_data.py @@ -64,13 +64,17 @@ def test_conversions(): convert_and_compare(xlsx_file=rfp("data/indirect_data.xlsx"), schema_file=rfp("data/indirect_schema.json"), known_good_file=rfp("data/indirect_data.json")) - convert_and_compare(xlsx_file=rfp("data/simple_data_ascii_chars.xlsx"), - schema_file=rfp("data/simple_schema.json"), - known_good_file=rfp("data/simple_data_ascii_chars.json")) convert_and_compare(xlsx_file=rfp("data/multiple_choice_data.xlsx"), schema_file=rfp("data/multiple_choice_schema.json"), known_good_file=rfp("data/multiple_choice_data.json")) + # Data loss when saving as xlsx + with pytest.raises(AssertionError) as err: + convert_and_compare(xlsx_file=rfp("data/simple_data_ascii_chars.xlsx"), + schema_file=rfp("data/simple_schema.json"), + known_good_file=rfp("data/simple_data_ascii_chars.json")) + assert str(err.value).startswith("Values at path ['Training', 0, ") + def test_set_in_nested(): """Test the ``_set_in_nested`` function.""" diff --git a/unittests/table_json_conversion/utils.py b/unittests/table_json_conversion/utils.py index 47fe83704a9bdc549a2256e708f4512df4cee2a7..0fcdbf390a3263481bd17a71717f697a3f9cc705 100644 --- a/unittests/table_json_conversion/utils.py +++ b/unittests/table_json_conversion/utils.py @@ -65,7 +65,7 @@ Raise an assertion exception if they are not equal.""" assert_equal_jsons(el1, el2, allow_none=allow_none, allow_empty=allow_empty, path=this_path) else: - assert el1 == el2 + assert el1 == el2, f"Values at path {this_path} are not equal:\n{el1},\n{el2}" def compare_workbooks(wb1: Workbook, wb2: Workbook, hidden: bool = True):