Skip to content
Snippets Groups Projects
Verified Commit fef11372 authored by Daniel Hornung's avatar Daniel Hornung
Browse files

MAINT: Adding NotImplementedError if validate=True

parent aa56cc0c
Branches
Tags
2 merge requests!128MNT: Added a warning when column metadata is not configured, and a better...,!126Fix pylint errors
Pipeline #59737 canceled
......@@ -710,7 +710,7 @@ def _set_in_nested(mydict: dict, path: list, value: Any, prefix: list = [], skip
# 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: bool = None, strict: bool = False) -> dict: # pylint: disable=unused-argument
validate: Optional[bool] = None, strict: bool = False) -> dict:
"""Convert the xlsx contents to a dict, it must follow a schema.
Parameters
......@@ -733,5 +733,9 @@ 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()
......@@ -43,7 +43,7 @@ def rfp(*pathcomponents):
def convert_and_compare(xlsx_file: str, schema_file: str, known_good_file: str,
known_good_data: Optional[dict] = None, strict: bool = False,
validate: bool = True) -> dict:
validate: bool = False) -> dict:
"""Convert an XLSX file and compare to a known result.
Exactly one of ``known_good_file`` and ``known_good_data`` should be non-empty.
......@@ -53,6 +53,8 @@ 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)
if known_good_file:
with open(known_good_file, encoding="utf-8") as myfile:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment