From a6e09ae528c68eab0a2c393eda63e7e819679ed8 Mon Sep 17 00:00:00 2001 From: konstantin Date: Fri, 31 May 2024 08:36:59 +0200 Subject: [PATCH] fix: format is not "AWF" but "UTILTS" (#10) * fix: format is not "AWF" but "UTILTS" * black --- README.md | 2 +- src/fundamend/reader/ahbreader.py | 2 +- unittests/example_ahb_utilts_11c.py | 18 +++++++++--------- unittests/example_ahb_utilts_11d.py | 18 +++++++++--------- unittests/test_ahbreader.py | 2 ++ 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 5eaef73..2f067b5 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ Das Ergebnis sieht dann so aus: "pruefidentifikator": "25001", "beschreibung": "Berechnungsformel", "kommunikation_von": "NB an MSB / LF", - "format": "AWF", + "format": "UTILTS", "segments": [ { "id": "UNH", diff --git a/src/fundamend/reader/ahbreader.py b/src/fundamend/reader/ahbreader.py index f481aa5..66a0d9a 100644 --- a/src/fundamend/reader/ahbreader.py +++ b/src/fundamend/reader/ahbreader.py @@ -237,7 +237,7 @@ def _read_anwendungsfall(self, original_element: ET.Element) -> Anwendungsfall: pruefidentifikator=original_element.attrib["Pruefidentifikator"], beschreibung=original_element.attrib["Beschreibung"], kommunikation_von=original_element.attrib["Kommunikation_von"], - format=original_element.tag.lstrip("M_"), + format=original_element[0].tag.lstrip("M_"), segments=[s for s in segments_and_groups if isinstance(s, Segment)], segment_groups=[s for s in segments_and_groups if isinstance(s, SegmentGroup)], ) diff --git a/unittests/example_ahb_utilts_11c.py b/unittests/example_ahb_utilts_11c.py index ba8b8f6..095ae7e 100644 --- a/unittests/example_ahb_utilts_11c.py +++ b/unittests/example_ahb_utilts_11c.py @@ -23,7 +23,7 @@ pruefidentifikator="25001", beschreibung="Berechnungsformel", kommunikation_von="NB an MSB / LF", - format="AWF", + format="UTILTS", segments=[ Segment( id="UNH", @@ -6731,7 +6731,7 @@ pruefidentifikator="25002", beschreibung="Ablehnung Berechnungsformel", kommunikation_von="MSB an NB", - format="AWF", + format="UTILTS", segments=[ Segment( id="UNH", @@ -13439,7 +13439,7 @@ pruefidentifikator="25003", beschreibung="Zustimmung Berechnungsformel", kommunikation_von="MSB an NB", - format="AWF", + format="UTILTS", segments=[ Segment( id="UNH", @@ -20147,7 +20147,7 @@ pruefidentifikator="25009", beschreibung="Übermittlung einer ausgerollten Leistungskurvendefinition", kommunikation_von="NB an LF / MSB\r\nLF an NB, MSB", - format="AWF", + format="UTILTS", segments=[ Segment( id="UNH", @@ -26855,7 +26855,7 @@ pruefidentifikator="25008", beschreibung="Übermittlung einer ausgerollten Schaltzeitdefinition", kommunikation_von="NB an LF / MSB\r\nLF an NB, MSB", - format="AWF", + format="UTILTS", segments=[ Segment( id="UNH", @@ -33563,7 +33563,7 @@ pruefidentifikator="25005", beschreibung="Übermittlung einer ausgerollten Zählzeitdefinition", kommunikation_von="NB an LF / MSB\r\nLF an MSB", - format="AWF", + format="UTILTS", segments=[ Segment( id="UNH", @@ -40271,7 +40271,7 @@ pruefidentifikator="25007", beschreibung="Übermittlung Übersicht Leistungskurvendefinitionen", kommunikation_von="NB an LF / MSB\r\nLF an NB, MSB", - format="AWF", + format="UTILTS", segments=[ Segment( id="UNH", @@ -46979,7 +46979,7 @@ pruefidentifikator="25006", beschreibung="Übermittlung Übersicht Schaltzeitdefinitionen", kommunikation_von="NB an LF / MSB\r\nLF an NB, MSB", - format="AWF", + format="UTILTS", segments=[ Segment( id="UNH", @@ -53687,7 +53687,7 @@ pruefidentifikator="25004", beschreibung="Übermittlung Übersicht Zählzeitdefinitionen", kommunikation_von="NB an LF / MSB\r\nLF an MSB", - format="AWF", + format="UTILTS", segments=[ Segment( id="UNH", diff --git a/unittests/example_ahb_utilts_11d.py b/unittests/example_ahb_utilts_11d.py index 8cc05dd..b9ec60f 100644 --- a/unittests/example_ahb_utilts_11d.py +++ b/unittests/example_ahb_utilts_11d.py @@ -23,7 +23,7 @@ pruefidentifikator="25001", beschreibung="Berechnungsformel", kommunikation_von="NB an MSB / LF", - format="AWF", + format="UTILTS", segments=[ Segment( id="UNH", @@ -6683,7 +6683,7 @@ pruefidentifikator="25002", beschreibung="Ablehnung Berechnungsformel", kommunikation_von="MSB an NB", - format="AWF", + format="UTILTS", segments=[ Segment( id="UNH", @@ -13343,7 +13343,7 @@ pruefidentifikator="25003", beschreibung="Zustimmung Berechnungsformel", kommunikation_von="MSB an NB", - format="AWF", + format="UTILTS", segments=[ Segment( id="UNH", @@ -20003,7 +20003,7 @@ pruefidentifikator="25009", beschreibung="Übermittlung einer ausgerollten Leistungskurvendefinition", kommunikation_von="NB an LF / MSB\r\nLF an NB, MSB", - format="AWF", + format="UTILTS", segments=[ Segment( id="UNH", @@ -26663,7 +26663,7 @@ pruefidentifikator="25008", beschreibung="Übermittlung einer ausgerollten Schaltzeitdefinition", kommunikation_von="NB an LF / MSB\r\nLF an NB, MSB", - format="AWF", + format="UTILTS", segments=[ Segment( id="UNH", @@ -33323,7 +33323,7 @@ pruefidentifikator="25005", beschreibung="Übermittlung einer ausgerollten Zählzeitdefinition", kommunikation_von="NB an LF / MSB\r\nLF an MSB", - format="AWF", + format="UTILTS", segments=[ Segment( id="UNH", @@ -39983,7 +39983,7 @@ pruefidentifikator="25007", beschreibung="Übermittlung Übersicht Leistungskurvendefinitionen", kommunikation_von="NB an LF / MSB\r\nLF an NB, MSB", - format="AWF", + format="UTILTS", segments=[ Segment( id="UNH", @@ -46643,7 +46643,7 @@ pruefidentifikator="25006", beschreibung="Übermittlung Übersicht Schaltzeitdefinitionen", kommunikation_von="NB an LF / MSB\r\nLF an NB, MSB", - format="AWF", + format="UTILTS", segments=[ Segment( id="UNH", @@ -53303,7 +53303,7 @@ pruefidentifikator="25004", beschreibung="Übermittlung Übersicht Zählzeitdefinitionen", kommunikation_von="NB an LF / MSB\r\nLF an MSB", - format="AWF", + format="UTILTS", segments=[ Segment( id="UNH", diff --git a/unittests/test_ahbreader.py b/unittests/test_ahbreader.py index 79c9004..6080f61 100644 --- a/unittests/test_ahbreader.py +++ b/unittests/test_ahbreader.py @@ -128,6 +128,8 @@ def test_get_anwendungsfall(ahb_xml_file_path: Path, pruefidentifikator: str, ex assert actual is not None assert isinstance(actual, Anwendungsfall) assert actual.pruefidentifikator == pruefidentifikator + if "UTILTS" in str(ahb_xml_file_path): + assert actual.format == "UTILTS" else: assert actual is None