Skip to content

Commit

Permalink
Merge pull request #3435 from VesnaT/fix_widget
Browse files Browse the repository at this point in the history
[FIX] OWDataProjectionWidget: Consider tables with nan-s equal
  • Loading branch information
lanzagar authored Dec 3, 2018
2 parents 8f9277c + 6b9b705 commit 323a738
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions Orange/widgets/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -896,9 +896,10 @@ def test_none_data(self):

def test_plot_once(self, timeout=DEFAULT_TIMEOUT):
"""Test if data is plotted only once but committed on every input change"""
table = Table("heart_disease")
self.widget.setup_plot = Mock()
self.widget.commit = Mock()
self.send_signal(self.widget.Inputs.data, self.data)
self.send_signal(self.widget.Inputs.data, table)
self.widget.setup_plot.assert_called_once()
self.widget.commit.assert_called_once()

Expand All @@ -907,7 +908,7 @@ def test_plot_once(self, timeout=DEFAULT_TIMEOUT):
self.assertTrue(spy.wait(timeout))

self.widget.commit.reset_mock()
self.send_signal(self.widget.Inputs.data_subset, self.data[::10])
self.send_signal(self.widget.Inputs.data_subset, table[::10])
self.widget.setup_plot.assert_called_once()
self.widget.commit.assert_called_once()

Expand Down
8 changes: 5 additions & 3 deletions Orange/widgets/visualize/utils/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,11 @@ def set_data(self, data):
if not same_domain:
self.init_attr_values()
self.openContext(self.data)
self.__invalidated = not (data_existed and self.data is not None and
np.array_equal(effective_data.X,
self.effective_data.X))
self.__invalidated = not (
data_existed and self.data is not None and
effective_data.X.shape == self.effective_data.X.shape and
np.allclose(effective_data.X,
self.effective_data.X, equal_nan=True))
if self.__invalidated:
self.clear()
self.cb_class_density.setEnabled(self.can_draw_density())
Expand Down

0 comments on commit 323a738

Please sign in to comment.