Skip to content

Commit

Permalink
OWDataSampler: Do not show messages when data is removed
Browse files Browse the repository at this point in the history
  • Loading branch information
VesnaT committed Nov 3, 2016
1 parent 3d865bc commit f2c5f72
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions Orange/widgets/data/owdatasampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ def set_data(self, dataset):
self.dataInfoLabel.setText('No data on input.')
self.outputInfoLabel.setText('')
self.indices = None
self.clear_messages()
self.commit()

def commit(self):
Expand Down
27 changes: 27 additions & 0 deletions Orange/widgets/data/tests/test_owdatasampler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Test methods with long descriptive names can omit docstrings
# pylint: disable=missing-docstring
from Orange.data import Table
from Orange.widgets.data.owdatasampler import OWDataSampler
from Orange.widgets.tests.base import WidgetTest


class TestOWDataSampler(WidgetTest):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.iris = Table("iris")

def setUp(self):
self.widget = self.create_widget(OWDataSampler)

def test_error_message(self):
""" Check if error message appears and then disappears when
data is removed from input"""
self.widget.controlledAttributes["sampling_type"][0].control.buttons[
2].click()
self.send_signal("Data", self.iris)
self.assertFalse(self.widget.Error.too_many_folds.is_shown())
self.send_signal("Data", self.iris[:5])
self.assertTrue(self.widget.Error.too_many_folds.is_shown())
self.send_signal("Data", None)
self.assertFalse(self.widget.Error.too_many_folds.is_shown())

0 comments on commit f2c5f72

Please sign in to comment.