From fa7c84b378e346940ab27f365a1f1f95bb47ccf9 Mon Sep 17 00:00:00 2001 From: Vesna Tanko Date: Fri, 12 Mar 2021 12:33:07 +0100 Subject: [PATCH] RadvizVizRank: Implement on_selection_changed --- Orange/widgets/visualize/owradviz.py | 3 +++ Orange/widgets/visualize/tests/test_owradviz.py | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/Orange/widgets/visualize/owradviz.py b/Orange/widgets/visualize/owradviz.py index c65a43ea07a..fea6f94b69f 100644 --- a/Orange/widgets/visualize/owradviz.py +++ b/Orange/widgets/visualize/owradviz.py @@ -139,6 +139,9 @@ def check_preconditions(self): len(master.model_selected))) return True + def on_selection_changed(self, selected, _): + self.on_row_clicked(selected.indexes()[0]) + def on_row_clicked(self, index): self.selectionChanged.emit(index.data(self._AttrRole)) diff --git a/Orange/widgets/visualize/tests/test_owradviz.py b/Orange/widgets/visualize/tests/test_owradviz.py index ed78ee9f9ad..4cc181eab92 100644 --- a/Orange/widgets/visualize/tests/test_owradviz.py +++ b/Orange/widgets/visualize/tests/test_owradviz.py @@ -1,5 +1,6 @@ # Test methods with long descriptive names can omit docstrings # pylint: disable=missing-docstring +import unittest from unittest.mock import Mock import numpy as np @@ -129,3 +130,17 @@ def test_invalidated_model_selected(self): self.widget.setup_plot.reset_mock() self.send_signal(self.widget.Inputs.data, self.data) self.widget.setup_plot.assert_called_once() + + def test_score_plots_feature_update(self): + self.send_signal(self.widget.Inputs.data, self.data) + selected_vars = set(self.widget.selected_vars) + output1 = self.get_output(self.widget.Outputs.components) + self.widget.vizrank.toggle() + self.process_events(until=lambda: not self.widget.vizrank.keep_running) + self.assertNotEqual(selected_vars, set(self.widget.selected_vars)) + output2 = self.get_output(self.widget.Outputs.components) + self.assertNotEqual(output1, output2) + + +if __name__ == "__main__": + unittest.main()