Skip to content

Commit

Permalink
Merge pull request #3985 from VesnaT/hidden_effective_variables_fix
Browse files Browse the repository at this point in the history
[FIX] Scatter plot: Hidden variables fix
  • Loading branch information
ajdapretnar authored Aug 28, 2019
2 parents 53e47df + 222e495 commit f4cbdbb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
15 changes: 15 additions & 0 deletions Orange/widgets/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,21 @@ def test_send_report(self, timeout=DEFAULT_TIMEOUT):
self.send_signal(self.widget.Inputs.data, None)
self.widget.report_button.click()

def test_hidden_effective_variables(self, timeout=DEFAULT_TIMEOUT):
hidden_var1 = ContinuousVariable("c1")
hidden_var1.attributes["hidden"] = True
hidden_var2 = ContinuousVariable("c2")
hidden_var2.attributes["hidden"] = True
class_vars = [DiscreteVariable("cls", values=["a", "b"])]
table = Table(Domain([hidden_var1, hidden_var2], class_vars),
np.array([[0., 1.], [2., 3.]]),
np.array([[0.], [1.]]))
self.send_signal(self.widget.Inputs.data, table)
if self.widget.isBlocking():
spy = QSignalSpy(self.widget.blockingStateChanged)
self.assertTrue(spy.wait(timeout))
self.send_signal(self.widget.Inputs.data, table)


class AnchorProjectionWidgetTestMixin(ProjectionWidgetTestMixin):
def test_embedding_missing_values(self):
Expand Down
2 changes: 1 addition & 1 deletion Orange/widgets/visualize/owscatterplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def _add_controls_sampling(self):

@property
def effective_variables(self):
return [self.attr_x, self.attr_y]
return [self.attr_x, self.attr_y] if self.attr_x and self.attr_y else []

def _vizrank_color_change(self):
self.vizrank.initialize()
Expand Down
4 changes: 2 additions & 2 deletions Orange/widgets/visualize/tests/test_owscatterplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ def test_invalidated_features_first(self):
# send features (same as default ones)
self.send_signal(self.widget.Inputs.features,
AttributeList(self.data.domain.attributes[:2]))
self.assertListEqual(self.widget.effective_variables, [None, None])
self.assertListEqual(self.widget.effective_variables, [])
self.widget.setup_plot.assert_called_once()

# send data
Expand Down Expand Up @@ -685,7 +685,7 @@ def test_invalidated_diff_features_features_first(self):
# send features (not the same as defaults)
self.send_signal(self.widget.Inputs.features,
AttributeList(self.data.domain.attributes[2:4]))
self.assertListEqual(self.widget.effective_variables, [None, None])
self.assertListEqual(self.widget.effective_variables, [])
self.widget.setup_plot.assert_called_once()

# send data
Expand Down

0 comments on commit f4cbdbb

Please sign in to comment.