Skip to content

Commit

Permalink
🐛 "MP-ID" is never a ValuePoolEntry (#201)
Browse files Browse the repository at this point in the history
  • Loading branch information
hf-kklein authored Dec 28, 2022
1 parent 3eae3d8 commit d75b822
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/maus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
)
from maus.models.message_implementation_guide import SegmentGroupHierarchy

_VERSION = "0.2.3" #: version to be writen into the deep ahb
_VERSION = "0.2.4" #: version to be writen into the deep ahb


def merge_lines_with_same_data_element(ahb_lines: Sequence[AhbLine]) -> DataElement:
Expand Down
2 changes: 1 addition & 1 deletion src/maus/models/edifact_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def deserialize(self, data, **kwargs) -> DataElementFreeText:
_simple_edifact_qualifier_pattern = re.compile(r"^([A-Z\d]+)|(\d+\.\d+[a-z])$")

#: a pattern that matches the GABi qualifiers: They contain with "-" and lower case "i"/"o"/"n"
gabi_edifact_qualifier_pattern = re.compile(r"^(GABi)?[A-Z\d\-]+(RLM(o|m)T)?$")
gabi_edifact_qualifier_pattern = re.compile(r"^(?!MP-ID)(GABi)?[A-Z\d\-]+(RLM(o|m)T)?$")


def _check_is_edifact_qualifier(instance, attribute, value):
Expand Down
2 changes: 1 addition & 1 deletion src/maus/reader/flat_ahb_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from maus.models.edifact_components import gabi_edifact_qualifier_pattern

_pruefi_pattern = re.compile(r"^\d{5}$") #: five digits
_value_pool_entry_pattern = re.compile(r"^[A-Z0-9\-i]{2,}$") # i for GABi -- why?
_value_pool_entry_pattern = re.compile(r"^(?!MP-ID)[A-Z0-9\-i]{2,}$") # i for GABi -- why?
_numeric_value_pool_entry_pattern = re.compile(r"^\d+(?:\.\d+)?[a-z]?$")
_ebd_code_pattern = re.compile(r"^([EG])_\d+$")
_segment_group_pattern = re.compile(r"^SG\d+$")
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/edifact-templates
14 changes: 14 additions & 0 deletions tests/unit_tests/test_ahb_csv_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,20 @@ def test_is_segment_group(self, value: Optional[str], expected_is_segment_group:
"Codeliste Gas Nr. G_0009",
id="EBD G",
),
pytest.param(
"MP-ID",
None,
None,
"MP-ID",
id="SG2 MP-ID",
),
pytest.param(
"MS",
"Dokumenten-/Nachrichtenausstellerbzw. -absender",
"MS",
"Dokumenten-/Nachrichtenausstellerbzw. -absender",
id="SG2 NAD+MS",
),
],
)
def test_code_description_separation(
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/test_maus.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def test_group_lines_by_segment_group(
],
),
DeepAnwendungshandbuch(
meta=AhbMetaInformation(pruefidentifikator="12345", maus_version="0.2.3"),
meta=AhbMetaInformation(pruefidentifikator="12345", maus_version="0.2.4"),
lines=[
SegmentGroup(
discriminator="root",
Expand Down

0 comments on commit d75b822

Please sign in to comment.