|
1 | 1 | # Test methods with long descriptive names can omit docstrings |
2 | | -# pylint: disable=missing-docstring |
| 2 | +# pylint: disable=missing-docstring,unsubscriptable-object |
| 3 | +from unittest.mock import Mock |
3 | 4 | import numpy as np |
4 | 5 |
|
5 | 6 | from Orange.data import Table |
|
12 | 13 | from Orange.widgets.data.owpreprocess import OWPreprocess, \ |
13 | 14 | UnivariateFeatureSelect, Scale as ScaleEditor |
14 | 15 | from Orange.widgets.tests.base import WidgetTest, datasets |
| 16 | +from orangewidget.widget import StateInfo |
15 | 17 |
|
16 | 18 |
|
17 | 19 | class TestOWPreprocess(WidgetTest): |
@@ -138,6 +140,25 @@ def test_data_column_nans(self): |
138 | 140 | self.widget.set_model(model) |
139 | 141 | self.send_signal(self.widget.Inputs.data, table) |
140 | 142 |
|
| 143 | + def test_summary(self): |
| 144 | + """Check if status bar is updated when data is received""" |
| 145 | + data = Table("iris") |
| 146 | + input_sum = self.widget.info.set_input_summary = Mock() |
| 147 | + output_sum = self.widget.info.set_output_summary = Mock() |
| 148 | + |
| 149 | + self.send_signal(self.widget.Inputs.data, data) |
| 150 | + input_sum.assert_called_with(int(StateInfo.format_number(len(data)))) |
| 151 | + output = self.get_output(self.widget.Outputs.preprocessed_data) |
| 152 | + output_sum.assert_called_with(int(StateInfo.format_number(len(output)))) |
| 153 | + |
| 154 | + input_sum.reset_mock() |
| 155 | + output_sum.reset_mock() |
| 156 | + self.send_signal(self.widget.Inputs.data, None) |
| 157 | + input_sum.assert_called_once() |
| 158 | + self.assertEqual(input_sum.call_args[0][0].brief, "") |
| 159 | + output_sum.assert_called_once() |
| 160 | + self.assertEqual(output_sum.call_args[0][0].brief, "") |
| 161 | + |
141 | 162 |
|
142 | 163 | # Test for editors |
143 | 164 | class TestDiscretizeEditor(WidgetTest): |
|
0 commit comments