-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(delete-apis): simplify error handling for deletions with binding…
… constraints
- Loading branch information
1 parent
c393a53
commit 75096fc
Showing
6 changed files
with
216 additions
and
93 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
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,25 @@ | ||
from antarest.core.exceptions import BindingConstraintDeletionNotAllowed | ||
|
||
|
||
class TestBindingConstraintDeletionNotAllowed: | ||
def test_few_binding_constraints(self) -> None: | ||
object_id = "france" | ||
binding_ids = ["bc1", "bc2"] | ||
object_type = "Area" | ||
exception = BindingConstraintDeletionNotAllowed(object_id, binding_ids, object_type=object_type) | ||
message = str(exception) | ||
assert f"{object_type} '{object_id}'" in message | ||
assert "bc1" in message | ||
assert "bc2" in message | ||
assert "more..." not in message | ||
|
||
def test_many_binding_constraints(self) -> None: | ||
object_id = "france" | ||
binding_ids = [f"bc{i}" for i in range(1, 50)] | ||
object_type = "Area" | ||
exception = BindingConstraintDeletionNotAllowed(object_id, binding_ids, object_type=object_type) | ||
message = str(exception) | ||
assert f"{object_type} '{object_id}'" in message | ||
assert "bc1" in message | ||
assert "bc2" in message | ||
assert "more..." in message |
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
Oops, something went wrong.