From 9aa7d9e8dbf022a1a98d9f6ae6f68890036cfd33 Mon Sep 17 00:00:00 2001 From: domna Date: Thu, 9 May 2024 23:14:40 +0200 Subject: [PATCH 1/2] Add edge cases to namefit documentation --- dev_tools/tests/test_nxdl_utils.py | 2 ++ dev_tools/utils/nxdl_utils.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/dev_tools/tests/test_nxdl_utils.py b/dev_tools/tests/test_nxdl_utils.py index 8618271d31..faf6f52a02 100644 --- a/dev_tools/tests/test_nxdl_utils.py +++ b/dev_tools/tests/test_nxdl_utils.py @@ -172,6 +172,8 @@ def test_namefitting(hdf_name, concept_name, should_fit): ("test_name", "test_name", 18), ("test_other", "test_name", -1), ("my_fancy_yet_long_name", "my_SOME_name", 8), + ("something", "XXXX", 0), + ("something", "OTHER", 1) ], ) def test_namefitting_scores(hdf_name, concept_name, score): diff --git a/dev_tools/utils/nxdl_utils.py b/dev_tools/utils/nxdl_utils.py index 4ecb0700e0..5a9f8f8f66 100644 --- a/dev_tools/utils/nxdl_utils.py +++ b/dev_tools/utils/nxdl_utils.py @@ -133,6 +133,8 @@ def get_nx_namefit(hdf_name: str, name: str, name_any: bool = False) -> int: * `get_nx_namefit("my_other_name", "TEST_name")` returns 5 * `get_nx_namefit("test_name", "test_name")` returns 18 * `get_nx_namefit("test_other", "test_name")` returns -1 + * `get_nx_namefit("something", "XXXX")` returns 0 + * `get_nx_namefit("something", "OTHER")` returns 1 Args: hdf_name (str): The hdf_name, containing the name of the HDF5 node. From cc046e03c6fc2b2b8561a2cce381cda7b4a9cd7d Mon Sep 17 00:00:00 2001 From: domna Date: Fri, 10 May 2024 06:58:53 +0200 Subject: [PATCH 2/2] Formatting --- dev_tools/tests/test_nxdl_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev_tools/tests/test_nxdl_utils.py b/dev_tools/tests/test_nxdl_utils.py index faf6f52a02..4d8c77f54f 100644 --- a/dev_tools/tests/test_nxdl_utils.py +++ b/dev_tools/tests/test_nxdl_utils.py @@ -173,7 +173,7 @@ def test_namefitting(hdf_name, concept_name, should_fit): ("test_other", "test_name", -1), ("my_fancy_yet_long_name", "my_SOME_name", 8), ("something", "XXXX", 0), - ("something", "OTHER", 1) + ("something", "OTHER", 1), ], ) def test_namefitting_scores(hdf_name, concept_name, score):