diff --git a/src/kohlrahbi/unfoldedahb/unfoldedahbtable.py b/src/kohlrahbi/unfoldedahb/unfoldedahbtable.py index 764ff361..f2a4ef55 100644 --- a/src/kohlrahbi/unfoldedahb/unfoldedahbtable.py +++ b/src/kohlrahbi/unfoldedahb/unfoldedahbtable.py @@ -506,6 +506,15 @@ def _remove_irrelevant_lines(lines: list[AhbLine]) -> list[AhbLine]: and line_dict["section_name"] is not None and line_dict["ahb_expression"] is None ) or (is_ahb_line_only_segment_group_header and is_next_ahb_line_empty) - if not is_empty_ahb_line: + + is_double_line = ( + line_dict["data_element"] is None + and line_dict["name"] == "" + and line_dict["segment_code"] is None + and line_dict["value_pool_entry"] is None + and line_dict["segment_group_key"] is not None + and line_dict["section_name"] is not None + ) + if not is_double_line and not is_empty_ahb_line: reduced_lines.append(line) return reduced_lines diff --git a/unittests/test_unfolded_ahb_table.py b/unittests/test_unfolded_ahb_table.py index 6f27924e..c896d626 100644 --- a/unittests/test_unfolded_ahb_table.py +++ b/unittests/test_unfolded_ahb_table.py @@ -322,6 +322,46 @@ def test_convert_to_dataframe(self): [], id="Empty Line", ), + pytest.param( + [ + AhbLine( + guid=None, + section_name="Ansprechpartner", + segment_group_key="SG3", + segment_code=None, + data_element=None, + value_pool_entry=None, + name=None, + ahb_expression="Kann", + index=0, + ), + AhbLine( + guid=None, + section_name="Ansprechpartner", + segment_group_key="SG3", + segment_code=None, + data_element=None, + value_pool_entry=None, + name="", + ahb_expression="Kann", + index=0, + ), + ], + [ + AhbLine( + guid=None, + section_name="Ansprechpartner", + segment_group_key="SG3", + segment_code=None, + data_element=None, + value_pool_entry=None, + name=None, + ahb_expression="Kann", + index=0, + ), + ], + id="Double Line", + ), ], ) def test_remove_irrelevant_lines(self, input_lines, expected_output):