|
| 1 | +# Test methods with long descriptive names can omit docstrings |
| 2 | +# pylint: disable=missing-docstring |
| 3 | +from unittest import skip |
| 4 | + |
| 5 | +import numpy as np |
| 6 | +from Orange.data import Table, ContinuousVariable |
| 7 | +from Orange.widgets.visualize.owboxplot import OWBoxPlot |
| 8 | +from Orange.widgets.tests.base import WidgetTest |
| 9 | + |
| 10 | + |
| 11 | +class TestOWBoxPlot(WidgetTest): |
| 12 | + @classmethod |
| 13 | + def setUpClass(cls): |
| 14 | + super().setUpClass() |
| 15 | + cls.iris = Table("iris") |
| 16 | + cls.zoo = Table("zoo") |
| 17 | + cls.housing = Table("housing") |
| 18 | + |
| 19 | + def setUp(self): |
| 20 | + self.widget = self.create_widget(OWBoxPlot) |
| 21 | + |
| 22 | + @skip("Known bug, FIXME!") |
| 23 | + def test_input_data(self): |
| 24 | + """Check widget's data""" |
| 25 | + self.assertEqual(self.widget.dataset, None) |
| 26 | + self.send_signal("Data", self.iris) |
| 27 | + self.assertGreater(len(self.widget.attrs), 0) |
| 28 | + self.send_signal("Data", None) |
| 29 | + self.assertEqual(len(self.widget.attrs), 0) |
| 30 | + |
| 31 | + def test_input_data_missings_cont_group_var(self): |
| 32 | + """Check widget with continuous data with missing values and group variable""" |
| 33 | + data = self.iris |
| 34 | + data.X[:, 0] = np.nan |
| 35 | + self.send_signal("Data", data) |
| 36 | + # used to crash, see #1568 |
| 37 | + |
| 38 | + def test_input_data_missings_cont_no_group_var(self): |
| 39 | + """Check widget with continuous data with missing values and no group variable""" |
| 40 | + data = self.housing |
| 41 | + data.X[:, 0] = np.nan |
| 42 | + self.send_signal("Data", data) |
| 43 | + # used to crash, see #1568 |
| 44 | + |
| 45 | + def test_input_data_missings_disc_group_var(self): |
| 46 | + """Check widget with discrete data with missing values and group variable""" |
| 47 | + data = self.zoo |
| 48 | + data.X[:, 0] = np.nan |
| 49 | + self.send_signal("Data", data) |
| 50 | + |
| 51 | + def test_input_data_missings_disc_no_group_var(self): |
| 52 | + """Check widget discrete data with missing values and no group variable""" |
| 53 | + data = self.zoo |
| 54 | + data.domain.class_var = ContinuousVariable("cls") |
| 55 | + data.X[:, 0] = np.nan |
| 56 | + self.send_signal("Data", data) |
0 commit comments