Skip to content

Commit 0f283c2

Browse files
committed
Process final review comments Signed-off-by: leovsch leo.25.1996@gmail.com
1 parent bb8de12 commit 0f283c2

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

src/power_grid_model/validation/_rules.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ def all_finite(data: SingleDataset, exceptions: dict[ComponentType, list[str]] |
749749

750750
def no_strict_subset_missing(data: SingleDataset, fields: list[str], component_type: ComponentType):
751751
"""
752-
Helper function that generates missing value errors if a subset of the supplied fields are missing.
752+
Helper function that generates multi field validation errors if a subset of the supplied fields is missing.
753753
If for an instance of component type all fields are missing or all fields are not missing then,
754754
no error is returned for that instance.
755755
In any other case an error for that id is returned.

src/power_grid_model/validation/_validation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,9 +546,9 @@ def validate_asym_line(data: SingleDataset) -> list[ValidationError]:
546546
):
547547
errors += _all_greater_than_zero(data, ComponentType.asym_line, field)
548548

549-
errors += _no_strict_subset_missing(data, optional_r_matrix_fields, ComponentType.asym_line)
550-
errors += _no_strict_subset_missing(data, optional_x_matrix_fields, ComponentType.asym_line)
549+
errors += _no_strict_subset_missing(data, optional_r_matrix_fields + optional_x_matrix_fields, ComponentType.asym_line)
551550
errors += _no_strict_subset_missing(data, required_c_matrix_fields, ComponentType.asym_line)
551+
errors += _no_strict_subset_missing(data, c_fields, ComponentType.asym_line)
552552
errors += _not_all_missing(data, required_c_matrix_fields + c_fields, ComponentType.asym_line)
553553

554554
return errors

tests/unit/validation/test_input_validation.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -758,17 +758,14 @@ def test_asym_line_input_data(input_data):
758758
assert NotGreaterThanError(ComponentType.asym_line, "c0", [55], 0) in validation_errors
759759
assert NotGreaterThanError(ComponentType.asym_line, "c1", [55], 0) in validation_errors
760760
assert (
761-
MultiFieldValidationError(ComponentType.asym_line, ["r_na", "r_nb", "r_nc", "r_nn"], [56]) in validation_errors
761+
MultiFieldValidationError(ComponentType.asym_line, ["r_na", "r_nb", "r_nc", "r_nn", "x_na", "x_nb", "x_nc", "x_nn"], [56, 57]) in validation_errors
762762
)
763763
assert (
764764
MultiFieldValidationError(
765765
ComponentType.asym_line, ["c_aa", "c_ba", "c_bb", "c_ca", "c_cb", "c_cc", "c0", "c1"], [56]
766766
)
767767
in validation_errors
768768
)
769-
assert (
770-
MultiFieldValidationError(ComponentType.asym_line, ["x_na", "x_nb", "x_nc", "x_nn"], [57]) in validation_errors
771-
)
772769
assert (
773770
MultiFieldValidationError(ComponentType.asym_line, ["c_aa", "c_ba", "c_bb", "c_ca", "c_cb", "c_cc"], [58])
774771
in validation_errors

0 commit comments

Comments
 (0)