Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/bo4e/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ def check_list_length_is_one_or_two(instance, attribute, value):
Check if list length is one or two.
So far only used in StandorteigenschaftenGas.
"""
if len(instance.netzkontonummern) == 0:
raise ValueError("Netzkontonummern must not be empty.")
if len(instance.netzkontonummern) > 2:
raise ValueError("Maximum number of Netzkontonummern is 2.")
if len(value) == 0:
raise ValueError(f"{attribute.name} must not be empty.")
if len(value) > 2:
raise ValueError(f"Maximum number of {attribute.name} is 2.")


# pylint:disable=too-few-public-methods
Expand Down
4 changes: 2 additions & 2 deletions tests/test_standorteigenschaftengas.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ def test_standorteigenschaftengas_missing_required_attributes(self):
[
pytest.param(
[],
"Netzkontonummern must not be empty.",
"netzkontonummern must not be empty.",
),
pytest.param(
["1", "2", "3"],
"Maximum number of Netzkontonummern is 2.",
"Maximum number of netzkontonummern is 2.",
),
],
)
Expand Down