generated from Hochfrequenz/python_template_repository
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bump ibims from 0.1.6 to 0.1.11 #59
Merged
Merged
Changes from 2 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
59300f6
Bump ibims from 0.1.6 to 0.1.7
dependabot[bot] 0163a35
Fix compatibility
lord-haffi a84629d
📍Pin pvframework
lord-haffi 69139ed
🩹
lord-haffi 5990b9f
🩹unittests
lord-haffi a2b5b15
🩹linter
lord-haffi b22c098
📄
lord-haffi 8c5f7a0
🩹
lord-haffi 9b413ba
🩹
lord-haffi 955828e
🩹mypy
lord-haffi 741a53c
Merge remote-tracking branch 'origin/main' into dependabot/pip/ibims-…
lord-haffi 16cb154
🩹linter
lord-haffi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,47 @@ | ||
from collections.abc import Container, Sequence | ||
from typing import Iterable, TypeVar | ||
|
||
from pvframework.errors import ValidationError | ||
|
||
T1 = TypeVar("T1") | ||
T2 = TypeVar("T2") | ||
|
||
|
||
def intersection_with_contains_str( | ||
set_sub_container: Iterable[T1], set_base_container: Iterable[T2] | ||
) -> tuple[list[T1], list[T2]]: | ||
""" | ||
Returns the intersection of two sets, but only if the intersection is not empty. | ||
:param set_sub_container: the set to be checked for intersection | ||
:param set_base_container: the set to be checked for intersection | ||
:return: the intersection of the two sets, if the intersection is not empty | ||
""" | ||
set_sub_container = list(set_sub_container) | ||
set_base_container = list(set_base_container) | ||
set_sub_container_intersection = [] | ||
set_base_container_intersection = [] | ||
for item_sub in set_sub_container: | ||
set_base_remove_list = [] | ||
for item_base in set_base_container: | ||
if str(item_sub) in str(item_base): | ||
set_sub_container_intersection.append(item_sub) | ||
set_base_container_intersection.append(item_base) | ||
set_base_remove_list.append(item_base) | ||
break | ||
for item_base in set_base_remove_list: | ||
set_base_container.remove(item_base) | ||
|
||
return set_sub_container_intersection, set_base_container_intersection | ||
|
||
|
||
def assert_full_error_coverage(expected_errors: Sequence[str], all_errors: Sequence[ValidationError]): | ||
expected_errors_found, actual_errors_from_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_from_expected_list): | ||
expected_errors_not_found = list(set(expected_errors) - set(expected_errors_found)) | ||
uncovered_actual_errors = list(set(all_errors) - set(actual_errors_from_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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allein aus dem im docstring beschriebenen zweck versteh ich nicht, warum du nicht die intersection von
set
verwendest oder sogarisdisjoint
? (letzteres liest sich ganz ähnlich... hab's aber nicht im detail geprüft). wenn das nen grund hat, kannste ihn ja kommentierenThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Das Problem in principle: Zwei Mengen
A
undB
, die jeweils Submengen beinhaltenA_i
undB_j
. Finde alleA_i
für die gilt: Es existiert mindestens einB_j
, sodassA_i ⊆ B_j
ist.Oder mehr am Beispiel: Die tatsächlichen Fehlermeldungen sind superlang. Daher hab ich in die Menge der
expected_errors
nur relevante Auszüge reingeschrieben. Da hilft mir dann die normale intersection leider nicht.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aber ich schreib das nochmal besser in den docstring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b22c098