-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OWDataTable: Output Annotated Data insted of Other Data
- Loading branch information
Showing
2 changed files
with
31 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,37 @@ | ||
from Orange.data import Table | ||
# Test methods with long descriptive names can omit docstrings | ||
# pylint: disable=missing-docstring | ||
from Orange.widgets.data.owtable import OWDataTable | ||
from Orange.widgets.tests.base import WidgetTest | ||
from Orange.widgets.tests.base import WidgetTest, WidgetOutputsTestMixin | ||
|
||
|
||
class TestOWDataTable(WidgetTest): | ||
class TestOWDataTable(WidgetTest, WidgetOutputsTestMixin): | ||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
WidgetOutputsTestMixin.init(cls) | ||
|
||
cls.signal_name = "Data" | ||
cls.signal_data = cls.data | ||
|
||
def setUp(self): | ||
self.widget = self.create_widget(OWDataTable) | ||
self.iris = Table("iris") | ||
|
||
def test_input_data(self): | ||
"""Check number of tabs with data on the input""" | ||
self.send_signal("Data", self.iris, 1) | ||
self.send_signal("Data", self.data, 1) | ||
self.assertEqual(self.widget.tabs.count(), 1) | ||
self.send_signal("Data", self.iris, 2) | ||
self.send_signal("Data", self.data, 2) | ||
self.assertEqual(self.widget.tabs.count(), 2) | ||
self.send_signal("Data", None, 1) | ||
self.assertEqual(self.widget.tabs.count(), 1) | ||
|
||
def test_data_model(self): | ||
self.send_signal("Data", self.iris, 1) | ||
self.assertEqual(self.widget.tabs.widget(0).model().rowCount(), len(self.iris)) | ||
self.send_signal("Data", self.data, 1) | ||
self.assertEqual(self.widget.tabs.widget(0).model().rowCount(), | ||
len(self.data)) | ||
|
||
def _select_data(self): | ||
self.widget.selected_cols = list(range(len(self.data.domain))) | ||
self.widget.selected_rows = list(range(0, len(self.data.domain), 10)) | ||
self.widget.set_selection() | ||
return self.widget.selected_rows |