-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4502 from aturanjanin/owpurgedomain
[ENH] OWPurgeDomain: Data info displayed in the status bar
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# pylint: disable=unsubscriptable-object | ||
from unittest.mock import Mock | ||
|
||
from Orange.data import Table | ||
from Orange.widgets.data.owpurgedomain import OWPurgeDomain | ||
from Orange.widgets.tests.base import WidgetTest | ||
from Orange.widgets.utils.state_summary import format_summary_details | ||
|
||
|
||
class TestOWPurgeDomain(WidgetTest): | ||
def setUp(self): | ||
self.widget = self.create_widget(OWPurgeDomain) | ||
self.iris = Table("iris") | ||
|
||
def test_summary(self): | ||
"""Check if the status bar is updated when data is received""" | ||
data = self.iris | ||
input_sum = self.widget.info.set_input_summary = Mock() | ||
output_sum = self.widget.info.set_output_summary = Mock() | ||
|
||
self.send_signal(self.widget.Inputs.data, data) | ||
input_sum.assert_called_with(len(data), format_summary_details(data)) | ||
output = self.get_output(self.widget.Outputs.data) | ||
output_sum.assert_called_with(len(output), | ||
format_summary_details(output)) | ||
input_sum.reset_mock() | ||
output_sum.reset_mock() | ||
self.send_signal(self.widget.Inputs.data, None) | ||
input_sum.assert_called_once() | ||
self.assertEqual(input_sum.call_args[0][0].brief, "") | ||
output_sum.assert_called_once() | ||
self.assertEqual(output_sum.call_args[0][0].brief, "") |