From 6cdd4f20cbdca9606c9d8bd1644b95bff6215970 Mon Sep 17 00:00:00 2001
From: "i.nueske" <i.nueske@indiscale.com>
Date: Sat, 8 Feb 2025 17:08:20 +0100
Subject: [PATCH] TST: Reenable failing test

---
 src/caosadvancedtools/table_json_conversion/convert.py | 8 +-------
 unittests/table_json_conversion/test_read_xlsx.py      | 4 +---
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/src/caosadvancedtools/table_json_conversion/convert.py b/src/caosadvancedtools/table_json_conversion/convert.py
index 4b02fa46..7d8060c0 100644
--- a/src/caosadvancedtools/table_json_conversion/convert.py
+++ b/src/caosadvancedtools/table_json_conversion/convert.py
@@ -707,8 +707,6 @@ def _set_in_nested(mydict: dict, path: list, value: Any, prefix: list = [], skip
     return mydict
 
 
-# ToDo: Fix https://gitlab.indiscale.com/caosdb/src/caosdb-advanced-user-tools/-/issues/138
-#       and remove pylint disable
 def to_dict(xlsx: Union[str, BinaryIO], schema: Union[dict, str, TextIO],
             validate: Optional[bool] = None, strict: bool = False) -> dict:
     """Convert the xlsx contents to a dict, it must follow a schema.
@@ -733,9 +731,5 @@ def to_dict(xlsx: Union[str, BinaryIO], schema: Union[dict, str, TextIO],
     out: dict
       A dict representing the JSON with the extracted data.
     """
-    if validate:
-        raise NotImplementedError(
-            "For input validation implement "
-            "https://gitlab.indiscale.com/caosdb/src/caosdb-advanced-user-tools/-/issues/138")
     converter = XLSXConverter(xlsx, schema, strict=strict)
-    return converter.to_dict()
+    return converter.to_dict(validate=validate)
diff --git a/unittests/table_json_conversion/test_read_xlsx.py b/unittests/table_json_conversion/test_read_xlsx.py
index ff32c6b1..5bee9297 100644
--- a/unittests/table_json_conversion/test_read_xlsx.py
+++ b/unittests/table_json_conversion/test_read_xlsx.py
@@ -53,9 +53,7 @@ Returns
 json: dict
   The result of the conversion.
     """
-    # FIXME Set default "validate" back to True, after implementation of
-    # https://gitlab.indiscale.com/caosdb/src/caosdb-advanced-user-tools/-/issues/138
-    result = convert.to_dict(xlsx=xlsx_file, schema=schema_file, validate=validate)
+    result = convert.to_dict(xlsx=xlsx_file, schema=schema_file, validate=True)
     if known_good_file:
         with open(known_good_file, encoding="utf-8") as myfile:
             expected = json.load(myfile)
-- 
GitLab