Skip to content

Commit

Permalink
Checkpoints for existing default attrib.
Browse files Browse the repository at this point in the history
  • Loading branch information
RubelMozumder committed Apr 26, 2024
1 parent 42201aa commit 4c36e5c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 0 additions & 3 deletions pynxtools/dataconverter/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,9 +867,6 @@ def set_default_attr_in_group(template):
for template_concept, val in template.items():
# skip the last part which is field
groups_list = template_concept.split("/")
# Cancel out the attribuutes
if groups_list[-1].startswith("@"):
continue
# Cancel out the fields and end groups without fields
groups_list = groups_list[0:-1]
if not groups_list:
Expand Down
6 changes: 6 additions & 0 deletions tests/dataconverter/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,9 @@ def test_path_in_data_dict(nxdl_path, expected, template):
"/ENTRY[entry1]/NXODD_name[nxodd_name_2]/float_value": 8.0,
"/ENTRY[entry1]/NXODD_name[nxodd_name_2]/DATA[data1]/data1": [3, 5, 6],
"/ENTRY[entry1]/NXODD_name[nxodd_name_2]/DATA[data2]/data2": [3, 5, 6],
"/ENTRY[entry2]/@default": "nxodd_name_2",
"/ENTRY[entry2]/NXODD_name[nxodd_name]/float_value": 2.0,
"/ENTRY[entry2]/NXODD_name[nxodd_name_2]/float_value": 8.0,
}
],
)
Expand Down Expand Up @@ -511,6 +514,9 @@ def test_set_default_attr_in_group(temp_dict):
"Group can not have a default attribute refering any field,"
" unless it is not supplied by reader."
)
assert (
template["/ENTRY[entry2]/@default"] == "nxodd_name_2"
), "Default attribute supplied by reader can not be overwritten."


def test_atom_type_extractor_and_hill_conversion():
Expand Down

0 comments on commit 4c36e5c

Please sign in to comment.