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..fbabca35f7c 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): @@ -132,16 +133,25 @@ def test_in_out_summary(self): info = self.widget.info self.assertEqual(info._StateInfo__input_summary.brief, "") self.assertEqual(info._StateInfo__output_summary.brief, "") + self.assertEqual(info._StateInfo__input_summary.details, "") + self.assertEqual(info._StateInfo__output_summary.details, "") 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"]) + self.assertEqual(info._StateInfo__input_summary.details, + format_summary_details(self.iris)) + output = self.get_output(self.widget.Outputs.inliers) + self.assertEqual(info._StateInfo__output_summary.details, + format_summary_details(output)) self.send_signal(self.widget.Inputs.data, None) self.wait_until_finished() self.assertEqual(info._StateInfo__input_summary.brief, "") self.assertEqual(info._StateInfo__output_summary.brief, "") + self.assertEqual(info._StateInfo__input_summary.details, "") + self.assertEqual(info._StateInfo__output_summary.details, "") @patch("Orange.widgets.data.owoutliers.OWOutliers.MAX_FEATURES", 3) @patch("Orange.widgets.data.owoutliers.OWOutliers.commit", Mock())