diff --git a/Orange/widgets/data/owcorrelations.py b/Orange/widgets/data/owcorrelations.py index b1e8952a11a..cac09cefc31 100644 --- a/Orange/widgets/data/owcorrelations.py +++ b/Orange/widgets/data/owcorrelations.py @@ -365,7 +365,11 @@ def set_data(self, data): def set_feature_model(self): self.feature_model.set_domain(self.cont_data and self.cont_data.domain) - self.feature = None + data = self.data + if data and data.domain.has_continuous_class and self.cont_data: + self.feature = self.cont_data.domain[data.domain.class_var.name] + else: + self.feature = None def apply(self): self.vizrank.initialize() diff --git a/Orange/widgets/data/tests/test_owcorrelations.py b/Orange/widgets/data/tests/test_owcorrelations.py index 7565b95e253..83679b8a5cb 100644 --- a/Orange/widgets/data/tests/test_owcorrelations.py +++ b/Orange/widgets/data/tests/test_owcorrelations.py @@ -125,8 +125,13 @@ def test_input_data_cont_target(self): self.send_signal(self.widget.Inputs.data, data) time.sleep(0.1) self.process_events() - self.assertEqual(self.widget.vizrank.rank_model.rowCount(), 3) + self.assertEqual(self.widget.vizrank.rank_model.rowCount(), 2) self.assertEqual(self.widget.controls.feature.count(), 4) + self.assertEqual(self.widget.controls.feature.currentText(), "MEDV") + + data = self.housing[:5, 13:] + self.send_signal(self.widget.Inputs.data, data) + self.assertTrue(self.widget.Warning.not_enough_vars.is_shown()) def test_output_data(self): """Check dataset on output"""