From 22b53f7a8c96ff894e1cdc227b35ce21753fa9af Mon Sep 17 00:00:00 2001 From: Daniel <d.hornung@indiscale.com> Date: Thu, 6 Feb 2025 16:35:16 +0100 Subject: [PATCH] STY, DOC: A few small changes to documentation and regression test. --- src/caoscrawler/converters/converters.py | 8 ++++---- unittests/test_issues.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/caoscrawler/converters/converters.py b/src/caoscrawler/converters/converters.py index 5fcdfda..e16b2c0 100644 --- a/src/caoscrawler/converters/converters.py +++ b/src/caoscrawler/converters/converters.py @@ -1295,17 +1295,17 @@ class YAMLFileConverter(SimpleFileConverter): def match_name_and_value(definition, name, value): """Take match definitions from the definition argument and apply regular expression to name and - possibly value + possibly value. - one of the keys 'match_name' and "match' needs to be available in definition - 'match_value' is optional + Exactly one of the keys ``match_name`` and ``match`` must exist in ``definition``, + ``match_value`` is optional Returns ------- out: None, if match_name or match lead to no match. Otherwise, returns a dictionary with the - matched groups, possibly including matches from using match_value + matched groups, possibly including matches from using `definition["match_value"]` """ if "match_name" in definition: diff --git a/unittests/test_issues.py b/unittests/test_issues.py index b7cde01..779f777 100644 --- a/unittests/test_issues.py +++ b/unittests/test_issues.py @@ -218,8 +218,8 @@ def test_issue_112(converter_registry): if rec.name == "event_a": assert rec.get_property("event_time") is not None assert rec.get_property("event_time").value == "2025-02-06" - elif rec.name == "event_b": - # This should not have matched + if rec.name == "event_b": + # `date` field is empty, so there must be no match assert rec.get_property("event_time") is None if rec.name == "event_c": assert rec.get_property("event_time") is not None -- GitLab