Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/pynxtools/dataconverter/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,8 +743,9 @@ def is_valid_data_field(

accepted_types = NEXUS_TO_PYTHON_DATA_TYPES[nxdl_type]

if isinstance(value, dict) and set(value.keys()) == {"compress", "strength"}:
value = value["compress"]
# TODO: do not convert here, rather check value["compress"] and leave value as is
# # if isinstance(value, dict) and set(value.keys()) == {"compress", "strength"}:
# value = value["compress"]

# Do not count other dicts as they represent a link value
if not isinstance(value, dict) and not is_valid_data_type(value, accepted_types):
Expand Down
18 changes: 10 additions & 8 deletions tests/dataconverter/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1709,10 +1709,11 @@ def listify_template(data_dict: Template):
{"compress": np.int64(2.0), "strength": 1},
),
[
"The value at /ENTRY[my_entry]/NXODD_name[nxodd_name]/float_value "
"should be one of the following Python types: "
"(<class 'float'>, <class 'numpy.floating'>), as defined in the "
"NXDL as NX_FLOAT."
# TODO: reactivate when the compression checks are reactivated
# # "The value at /ENTRY[my_entry]/NXODD_name[nxodd_name]/float_value "
# "should be one of the following Python types: "
# "(<class 'float'>, <class 'numpy.floating'>), as defined in the "
# "NXDL as NX_FLOAT."
],
id="appdef-compressed-payload-wrong-type",
),
Expand All @@ -1732,10 +1733,11 @@ def listify_template(data_dict: Template):
{"compress": np.float32(2.0), "strength": 3},
),
[
"The value at /ENTRY[my_entry]/SAMPLE[sample1]]/changer_position "
"should be one of the following Python types: "
"(<class 'int'>, <class 'numpy.integer'>), as defined in the "
"NXDL as NX_INT."
# TODO: reactivate when the compression checks are reactivated
# "The value at /ENTRY[my_entry]/SAMPLE[sample1]]/changer_position "
# "should be one of the following Python types: "
# "(<class 'int'>, <class 'numpy.integer'>), as defined in the "
# "NXDL as NX_INT."
],
id="baseclass-compressed-payload-wrong-type",
),
Expand Down
Loading