Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/pip/dev_requirements/certifi-2024…
Browse files Browse the repository at this point in the history
….7.4
  • Loading branch information
hf-kklein committed Jul 11, 2024
2 parents 86b8d02 + e0aa0d7 commit bdcc003
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
6 changes: 3 additions & 3 deletions dev_requirements/requirements-type_check.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
#
# pip-compile-multi
#
mypy==1.10.0
# via -r dev_requirements\requirements-type_check.in
mypy==1.10.1
# via -r dev_requirements/requirements-type_check.in
mypy-extensions==1.0.0
# via mypy
types-xmltodict==0.13.0.3
# via -r dev_requirements\requirements-type_check.in
# via -r dev_requirements/requirements-type_check.in
typing-extensions==4.11.0
# via mypy
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile requirements.in
Expand All @@ -8,6 +8,8 @@ attrs==23.2.0
# via -r requirements.in
click==8.1.7
# via -r requirements.in
colorama==0.4.6
# via click
lark==1.1.9
# via -r requirements.in
lxml==5.2.2
Expand Down
9 changes: 8 additions & 1 deletion src/maus/models/anwendungshandbuch.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,13 @@ class AhbLine:
)
"""a requirement indicator + an optional condition ("ahb expression"), e.g. 'Muss [123] O [456]' """
# note: to parse expressions from AHBs consider using AHBicht: https://github.com/Hochfrequenz/ahbicht/

conditions: Optional[str] = attrs.field(
validator=attrs.validators.optional(validator=attrs.validators.instance_of(str)), default=None
)
"""
The condition text describes the text to the optional condition of the ahb expression.
E.g. '[492] This is a condition text. [999] And this is another one.'
"""
section_name: Optional[str] = attrs.field(
validator=attrs.validators.optional(validator=attrs.validators.instance_of(str)), default=None
)
Expand Down Expand Up @@ -141,6 +147,7 @@ class AhbLineSchema(Schema):
value_pool_entry = fields.String(required=False, load_default=None)
name = fields.String(required=False, load_default=None)
ahb_expression = fields.String(required=False, load_default=None)
conditions = fields.String(required=False, load_default=None)
section_name = fields.String(required=False, load_default=None)
index = fields.Int(required=False, load_default=None, dump_default=None)

Expand Down
12 changes: 12 additions & 0 deletions tests/unit_tests/test_ahb.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

line_x = AhbLine(
ahb_expression="Muss [1] O [2]",
conditions="[1] Test\n[2] Test",
segment_group_key="SG2",
segment_code="NAD",
data_element="3039",
Expand All @@ -37,6 +38,7 @@
)
line_y = AhbLine(
ahb_expression="Muss [3] O [4]",
conditions="[3] Test\n[4] Test",
segment_group_key="SG2",
segment_code="NAD",
data_element="3039",
Expand Down Expand Up @@ -86,6 +88,7 @@ def test_ahb_meta_information_equality(self, ahb_x: AhbMetaInformation, ahb_y: A
pytest.param(
AhbLine(
ahb_expression="Muss [1] O [2]",
conditions="[1] Test\n[2] Test",
segment_group_key="SG2",
segment_code="NAD",
segment_id="01234",
Expand All @@ -105,12 +108,14 @@ def test_ahb_meta_information_equality(self, ahb_x: AhbMetaInformation, ahb_y: A
"name": "MP-ID",
"guid": "12b1a98a-edf5-4177-89e5-a6d8a92c5fdc",
"section_name": "Foo",
"conditions": "[1] Test\n[2] Test",
"index": None,
},
),
pytest.param(
AhbLine(
ahb_expression="Muss [1] O [2]",
conditions="[1] Test\n[2] Test",
segment_group_key="SG2",
segment_code="NAD",
segment_id=None,
Expand All @@ -131,6 +136,7 @@ def test_ahb_meta_information_equality(self, ahb_x: AhbMetaInformation, ahb_y: A
"name": "MP-ID",
"guid": "12b1a98a-edf5-4177-89e5-a6d8a92c5fdc",
"section_name": "Foo",
"conditions": "[1] Test\n[2] Test",
"index": 42,
},
),
Expand All @@ -156,6 +162,7 @@ def test_ahb_line_equality(self, line_x: AhbLine, line_y: AhbLine, are_equal: bo
pytest.param(
AhbLine(
ahb_expression="Muss [1] O [2]",
conditions="[1] Test\n[2] Test",
segment_group_key="SG2",
segment_code="NAD",
data_element="3039",
Expand Down Expand Up @@ -201,6 +208,7 @@ def test_ahbline_holds_any_information(self, ahb_line: AhbLine, expected_holds_a
pytest.param(
AhbLine(
ahb_expression="Muss [1] O [2]",
conditions="[1] Test\n[2] Test",
segment_group_key="SG2",
segment_code="NAD",
data_element="3039",
Expand All @@ -214,6 +222,7 @@ def test_ahbline_holds_any_information(self, ahb_line: AhbLine, expected_holds_a
pytest.param(
AhbLine(
ahb_expression="Muss [1] O [2]",
conditions="[1] Test\n[2] Test",
segment_group_key="SG2",
segment_code="NAD",
data_element="3039",
Expand All @@ -227,6 +236,7 @@ def test_ahbline_holds_any_information(self, ahb_line: AhbLine, expected_holds_a
pytest.param(
AhbLine(
ahb_expression="Muss [1] O [2]",
conditions="[1] Test\n[2] Test",
segment_group_key=None,
segment_code="UNH",
data_element="0062",
Expand All @@ -252,6 +262,7 @@ def test_ahbline_get_discriminator(self, ahb_line: AhbLine, include_name: bool,
lines=[
AhbLine(
ahb_expression="Muss [1] O [2]",
conditions="[1] Test\n[2] Test",
segment_group_key="SG2",
segment_code="NAD",
data_element="3039",
Expand Down Expand Up @@ -280,6 +291,7 @@ def test_ahbline_get_discriminator(self, ahb_line: AhbLine, include_name: bool,
"name": "MP-ID",
"guid": "12b1a98a-edf5-4177-89e5-a6d8a92c5fdc",
"section_name": "MP-ID Absender",
"conditions": "[1] Test\n[2] Test",
"index": None,
}
],
Expand Down

0 comments on commit bdcc003

Please sign in to comment.