From 6ac6855f2ed6c8c18cd7758908da7927bca6ad14 Mon Sep 17 00:00:00 2001 From: Rubel Date: Fri, 26 Apr 2024 13:36:07 +0200 Subject: [PATCH] Test for dataconverter. --- tests/dataconverter/test_helpers.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/dataconverter/test_helpers.py b/tests/dataconverter/test_helpers.py index 8a1319fb6..70e1b0226 100644 --- a/tests/dataconverter/test_helpers.py +++ b/tests/dataconverter/test_helpers.py @@ -26,6 +26,7 @@ from setuptools import distutils from pynxtools.dataconverter import helpers +from pynxtools.dataconverter.helpers import set_default_group from pynxtools.dataconverter.template import Template @@ -462,6 +463,32 @@ def test_path_in_data_dict(nxdl_path, expected, template): assert helpers.path_in_data_dict(nxdl_path, tuple(template.keys())) == expected +def test_set_default_group(template): + """_summary_ + + Parameters + ---------- + template : Template + """ + assert ( + "/@default" not in template + ), "To test the root level /@default should be empty." + assert ( + "/ENTRY[entry]/@default" not in template + ), "To test default attribute, entry attribute should be empty." + + set_default_group(template) + + assert ( + template["/@default"] == "entry", + "To test the root level /@default should be empty.", + ) + assert ( + template["/ENTRY[entry]/@default"] == "nxodd_name", + "To test default attribute, entry attribute should be empty.", + ) + + def test_atom_type_extractor_and_hill_conversion(): """ Test atom type extractor and conversion to hill