From 5bd2e856a86a17d369c69f212e3f309e113e0196 Mon Sep 17 00:00:00 2001 From: Aleksandra Date: Wed, 18 Mar 2020 18:34:44 +0100 Subject: [PATCH] Data info displayed in the status bar --- Orange/widgets/data/owoutliers.py | 8 ++++++-- Orange/widgets/data/tests/test_owoutliers.py | 9 +++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Orange/widgets/data/owoutliers.py b/Orange/widgets/data/owoutliers.py index 5a1c76142a9..b32204be614 100644 --- a/Orange/widgets/data/owoutliers.py +++ b/Orange/widgets/data/owoutliers.py @@ -18,6 +18,7 @@ from Orange.widgets.utils.concurrent import TaskState, ConcurrentWidgetMixin from Orange.widgets.utils.sql import check_sql_input from Orange.widgets.utils.widgetpreview import WidgetPreview +from Orange.widgets.utils.state_summary import format_summary_details from Orange.widgets.widget import Msg, Input, Output, OWWidget @@ -265,7 +266,9 @@ def set_data(self, data): self.cancel() self.clear_messages() self.data = data - self.info.set_input_summary(len(data) if data else self.info.NoOutput) + summary = len(data) if data else self.info.NoInput + details = format_summary_details(data) if data else "" + self.info.set_input_summary(summary, details) self.enable_controls() self.unconditional_commit() @@ -294,7 +297,8 @@ def on_partial_result(self, _): def on_done(self, result: Results): inliers, outliers = result.inliers, result.outliers summary = len(inliers) if inliers else self.info.NoOutput - self.info.set_output_summary(summary) + details = format_summary_details(inliers) if inliers else "" + self.info.set_output_summary(summary, details) self.n_inliers = len(inliers) if inliers else None self.n_outliers = len(outliers) if outliers else None diff --git a/Orange/widgets/data/tests/test_owoutliers.py b/Orange/widgets/data/tests/test_owoutliers.py index 91600805fa3..f28f9e70c9f 100644 --- a/Orange/widgets/data/tests/test_owoutliers.py +++ b/Orange/widgets/data/tests/test_owoutliers.py @@ -8,6 +8,7 @@ from Orange.classification import LocalOutlierFactorLearner from Orange.widgets.data.owoutliers import OWOutliers, run from Orange.widgets.tests.base import WidgetTest, simulate +from Orange.widgets.utils.state_summary import format_summary_details class TestRun(unittest.TestCase): @@ -130,13 +131,17 @@ def test_nans(self): def test_in_out_summary(self): info = self.widget.info + data = self.iris + input_sum = self.widget.info.set_input_summary = Mock() + output_sum = self.widget.info.set_output_summary = Mock() self.assertEqual(info._StateInfo__input_summary.brief, "") self.assertEqual(info._StateInfo__output_summary.brief, "") self.send_signal(self.widget.Inputs.data, self.iris) self.wait_until_finished() - self.assertEqual(info._StateInfo__input_summary.brief, "150") - self.assertIn(info._StateInfo__output_summary.brief, ["135", "136"]) + input_sum.assert_called_with(len(data), format_summary_details(data)) + output = self.get_output(self.widget.Outputs.inliers) + output_sum.assert_called_with(len(output), format_summary_details(output)) self.send_signal(self.widget.Inputs.data, None) self.wait_until_finished()