|
7 | 7 |
|
8 | 8 | from Orange.widgets.data.owdatasets import OWDataSets |
9 | 9 | from Orange.widgets.tests.base import WidgetTest |
| 10 | +from Orange.widgets.utils.state_summary import format_summary_details |
10 | 11 |
|
11 | 12 |
|
12 | 13 | class TestOWDataSets(WidgetTest): |
@@ -75,6 +76,24 @@ def test_dir_depth(self): |
75 | 76 | self.wait_until_stop_blocking(w) |
76 | 77 | self.assertEqual(w.view.model().rowCount(), 2) |
77 | 78 |
|
| 79 | + @patch("Orange.widgets.data.owdatasets.OWDataSets.list_remote", |
| 80 | + Mock(return_value={('core', 'iris.tab'): {}})) |
| 81 | + @patch("Orange.widgets.data.owdatasets.OWDataSets.list_local", |
| 82 | + Mock(return_value={})) |
| 83 | + @patch("Orange.widgets.data.owdatasets.ensure_local", |
| 84 | + Mock(return_value="iris.tab")) |
| 85 | + def test_summary(self): |
| 86 | + """Check if status bar is updated when data is received""" |
| 87 | + widget = self.create_widget(OWDataSets) |
| 88 | + output_sum = widget.info.set_output_summary = Mock() |
| 89 | + self.wait_until_stop_blocking(widget) |
| 90 | + # select the only dataset |
| 91 | + sel_type = QItemSelectionModel.ClearAndSelect | QItemSelectionModel.Rows |
| 92 | + widget.view.selectionModel().select(widget.view.model().index(0, 0), sel_type) |
| 93 | + widget.commit() |
| 94 | + output = self.get_output(widget.Outputs.data, widget) |
| 95 | + output_sum.assert_called_with(len(output), |
| 96 | + format_summary_details(output)) |
78 | 97 |
|
79 | 98 | if __name__ == "__main__": |
80 | 99 | unittest.main() |
0 commit comments