Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thocevar committed May 10, 2019
1 parent 681265c commit c98a36b
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion Orange/widgets/visualize/tests/test_owpythagoreanforest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@
from Orange.regression.random_forest import RandomForestRegressionLearner
from Orange.widgets.tests.base import WidgetTest
from Orange.widgets.tests.utils import simulate
from Orange.widgets.visualize.owpythagorastree import OWPythagorasTree
from Orange.widgets.visualize.owpythagoreanforest import OWPythagoreanForest
from Orange.widgets.visualize.pythagorastreeviewer import PythagorasTreeViewer
from Orange.widgets.visualize.pythagorastreeviewer import (
PythagorasTreeViewer,
SquareGraphicsItem
)


class TestOWPythagoreanForest(WidgetTest):
Expand Down Expand Up @@ -201,3 +205,16 @@ def _callback():
# Check that individual squares all have the same color
colors_same = [self._check_all_same(x) for x in zip(*colors)]
self.assertTrue(all(colors_same))

def test_forest_tree_table(self):
forest_w = self.widget
for data in (self.housing, self.titanic):
self.send_signal(forest_w.Inputs.random_forest, data)
tree = self._get_first_tree().tree_adapter.model

tree_w = self.create_widget(OWPythagorasTree)
self.send_signal(tree_w.Inputs.tree, tree, widget=tree_w)
square = [i for i in tree_w.scene.items() if isinstance(i, SquareGraphicsItem)][-1]
square.setSelected(True)
tab = self.get_output(tree_w.Outputs.selected_data, widget=tree_w)
self.assertGreater(len(tab), 0)

0 comments on commit c98a36b

Please sign in to comment.