Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/pip/pytest-asyncio-0.23.7
Browse files Browse the repository at this point in the history
  • Loading branch information
hf-kklein committed Jul 11, 2024
2 parents 04c9619 + 502b82b commit 10f41f1
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 16 deletions.
2 changes: 1 addition & 1 deletion dev_requirements/requirements-linting.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ mccabe==0.7.0
# via pylint
platformdirs==4.2.2
# via pylint
pylint==3.2.2
pylint==3.2.5
# via -r dev_requirements/requirements-linting.in
tomlkit==0.12.5
# via pylint
8 changes: 2 additions & 6 deletions dev_requirements/requirements-test_packaging.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#
# pip-compile-multi
#
backports-tarfile==1.1.1
# via jaraco-context
build==1.2.1
# via -r dev_requirements/requirements-test_packaging.in
certifi==2024.2.2
Expand All @@ -22,9 +20,7 @@ docutils==0.21.2
idna==3.7
# via requests
importlib-metadata==7.1.0
# via
# keyring
# twine
# via twine
jaraco-classes==3.4.0
# via keyring
jaraco-context==5.3.0
Expand All @@ -41,7 +37,7 @@ markdown-it-py==3.0.0
# via rich
mdurl==0.1.2
# via markdown-it-py
more-itertools==10.2.0
more-itertools==10.3.0
# via
# jaraco-classes
# jaraco-functools
Expand Down
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: 2 additions & 2 deletions 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 @@ -14,7 +14,7 @@ lxml==5.2.2
# via -r requirements.in
marshmallow==3.21.3
# via -r requirements.in
more-itertools==10.2.0
more-itertools==10.3.0
# via -r requirements.in
packaging==24.0
# via marshmallow
Expand Down
4 changes: 2 additions & 2 deletions src/maus/edifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class EdifactFormatVersion(str, Enum):
FV2310 = "FV2310" #: valid from 2023-10-01 onwards
FV2404 = "FV2404" #: valid from 2024-04-01 onwards
FV2410 = "FV2410" #: valid from 2024-10-01 onwards
FV2504 = "FV2504" #: valid from 2025-01-01 onwards
FV2504 = "FV2504" #: valid from 2025-04-04 onwards
FV2510 = "FV2510" #: valid from 2025-10-01 onwards
# whenever you add another value here, please also make sure to add its key date to get_edifact_format_version below

Expand All @@ -103,7 +103,7 @@ def get_edifact_format_version(key_date: datetime.datetime) -> EdifactFormatVers
(datetime.datetime(2023, 9, 30, 22, 0, 0, 0, tzinfo=datetime.timezone.utc), EdifactFormatVersion.FV2304),
(datetime.datetime(2024, 4, 2, 22, 0, 0, 0, tzinfo=datetime.timezone.utc), EdifactFormatVersion.FV2310),
(datetime.datetime(2024, 9, 30, 22, 0, 0, 0, tzinfo=datetime.timezone.utc), EdifactFormatVersion.FV2404),
(datetime.datetime(2025, 3, 31, 22, 0, 0, 0, tzinfo=datetime.timezone.utc), EdifactFormatVersion.FV2410),
(datetime.datetime(2025, 4, 3, 22, 0, 0, 0, tzinfo=datetime.timezone.utc), EdifactFormatVersion.FV2410),
(datetime.datetime(2025, 9, 30, 22, 0, 0, 0, tzinfo=datetime.timezone.utc), EdifactFormatVersion.FV2504),
]

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
3 changes: 2 additions & 1 deletion tests/unit_tests/test_edifact_enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ def test_pruefi_to_format(self, expectation_tuple: Tuple[str, EdifactFormat]):
pytest.param(datetime(2024, 4, 2, 22, 0, 0, tzinfo=timezone.utc), EdifactFormatVersion.FV2404),
pytest.param(datetime(2024, 9, 30, 21, 59, 59, tzinfo=timezone.utc), EdifactFormatVersion.FV2404),
pytest.param(datetime(2024, 9, 30, 22, 0, 0, 0, tzinfo=timezone.utc), EdifactFormatVersion.FV2410),
pytest.param(datetime(2025, 3, 31, 22, 0, 0, tzinfo=timezone.utc), EdifactFormatVersion.FV2504),
pytest.param(datetime(2025, 3, 31, 22, 0, 0, tzinfo=timezone.utc), EdifactFormatVersion.FV2410),
pytest.param(datetime(2025, 4, 3, 22, 0, 0, tzinfo=timezone.utc), EdifactFormatVersion.FV2504),
pytest.param(datetime(2025, 9, 30, 22, 0, 0, tzinfo=timezone.utc), EdifactFormatVersion.FV2510),
pytest.param(
datetime(2050, 10, 1, 0, 0, 0, tzinfo=timezone.utc), EdifactFormatVersion.FV2510
Expand Down

0 comments on commit 10f41f1

Please sign in to comment.