-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Combine error and warning boxes that have the same message
- Loading branch information
1 parent
f29176b
commit 90998f2
Showing
3 changed files
with
143 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import pytest | ||
from qtpy.QtWidgets import QWidget | ||
|
||
from ert.config import ErrorInfo | ||
from ert.gui.suggestor import Suggestor | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"errors, expected_num", | ||
[ | ||
([ErrorInfo("msg_1")], 1), | ||
([ErrorInfo("msg_1"), ErrorInfo("msg_2")], 2), | ||
([ErrorInfo("msg_1"), ErrorInfo("msg_1"), ErrorInfo("msg_2")], 2), | ||
([ErrorInfo("msg_1"), ErrorInfo("msg_2"), ErrorInfo("msg_3")], 3), | ||
], | ||
) | ||
def test_suggestor_combines_errors_with_the_same_message(qtbot, errors, expected_num): | ||
suggestor = Suggestor(errors, [], [], lambda: None) | ||
msgs = suggestor.findChild(QWidget, name="suggestor_messages") | ||
assert msgs is not None | ||
msg_layout = msgs.layout() | ||
assert msg_layout is not None | ||
assert msg_layout.count() == expected_num |