From 8d1874806ced920f8d11d7e4b4697a159fb73143 Mon Sep 17 00:00:00 2001
From: Daniel <d.hornung@indiscale.com>
Date: Tue, 30 Apr 2024 13:08:28 +0200
Subject: [PATCH] TEST: Fixed test for XSLX files with data loss.

---
 unittests/table_json_conversion/test_read_data.py | 10 +++++++---
 unittests/table_json_conversion/utils.py          |  2 +-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/unittests/table_json_conversion/test_read_data.py b/unittests/table_json_conversion/test_read_data.py
index b5dcafc7..76f9c03f 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 47fe8370..0fcdbf39 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):
-- 
GitLab