generated from Hochfrequenz/python_template_repository
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump ibims from 0.1.6 to 0.1.9 (#59)
* Bump ibims from 0.1.6 to 0.1.7 Bumps [ibims](https://github.com/Hochfrequenz/intermediate-bo4e-migration-models) from 0.1.6 to 0.1.7. - [Release notes](https://github.com/Hochfrequenz/intermediate-bo4e-migration-models/releases) - [Commits](Hochfrequenz/intermediate-bo4e-migration-models@v0.1.6...v0.1.7) --- updated-dependencies: - dependency-name: ibims dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Fix compatibility * 📍Pin pvframework * 🩹 * 🩹unittests * 🩹linter * 📄 * 🩹 * 🩹 * 🩹mypy * 🩹linter --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Leon Haffmans <[email protected]>
- Loading branch information
1 parent
711073e
commit ac10d5f
Showing
9 changed files
with
169 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
bomf | ||
pvframework | ||
ibims | ||
pvframework>=0.0.8 | ||
ibims>=0.1.11 | ||
python-dateutil | ||
pydantic[email] | ||
more_itertools | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
from typing import TypeVar | ||
|
||
from pvframework.errors import ValidationError | ||
|
||
SubT = TypeVar("SubT") | ||
BaseT = TypeVar("BaseT") | ||
|
||
|
||
def intersection_with_contains_str( | ||
set_sub_container: set[SubT], set_base_container: set[BaseT] | ||
) -> tuple[set[SubT], set[BaseT]]: | ||
r""" | ||
Calculates all elements from both sets "intersecting" in the following manner: | ||
Let's call `set_sub_container` A and `set_base_container` B. | ||
A consists of elements a1, a2, a3, ... | ||
B consists of elements b1, b2, b3, ... | ||
It returns a tuple two sets: | ||
The first set contains all elements from A that are contained in at least one element of B. | ||
I.e. {a_i ∈ A | ∃ b_j ∈ B : a_i ⊆ b_j} | ||
LaTeX-Code: \left\{a_i \in A | \exists_{b_j \in B}: a_i \subseteq b_j\right\} | ||
The second set contains all elements from B that have at least one element of A being a substring of the element | ||
from B. | ||
I.e. {b_j ∈ B | ∃ a_i ∈ A : b_j ⊇ a_i} | ||
LaTeX-Code: \left\{b_j \in B | \exists_{a_i \in A}: b_j \supseteq a_i\right\} | ||
""" | ||
set_sub_container_intersection = set() | ||
set_base_container_intersection = set() | ||
for item_base in set_base_container: | ||
for item_sub in set_sub_container: | ||
if str(item_sub) in str(item_base): | ||
set_sub_container_intersection.add(item_sub) | ||
set_base_container_intersection.add(item_base) | ||
break | ||
|
||
return set_sub_container_intersection, set_base_container_intersection | ||
|
||
|
||
def assert_full_error_coverage(expected_errors: set[str], all_errors: set[ValidationError]): | ||
""" | ||
Asserts that all expected errors are found in the actual errors and vice versa. | ||
The error messages in `expected_errors` don't have to be exact matches. | ||
Every actual error message must have at least one element in `expected_errors` being | ||
a substring of the actual error message. | ||
""" | ||
expected_errors_found, actual_errors_in_expected_list = intersection_with_contains_str(expected_errors, all_errors) | ||
if len(expected_errors) != len(expected_errors_found) or len(all_errors) != len(actual_errors_in_expected_list): | ||
expected_errors_not_found = expected_errors - expected_errors_found | ||
uncovered_actual_errors = all_errors - actual_errors_in_expected_list | ||
raise AssertionError( | ||
f"Expected errors not found: {expected_errors_not_found}\n" | ||
f"Actual errors not covered from expected list: {uncovered_actual_errors}" | ||
) |
Oops, something went wrong.