source: orange/Orange/OrangeCanvas/scheme/tests/test_links.py @ 11101:e5aa7c1c5b23

Revision 11101:e5aa7c1c5b23, 1.3 KB checked in by Ales Erjavec <ales.erjavec@…>, 19 months ago (diff)

Added scheme package, containing the scheme graph workflow data structure/model.

Line 
1"""
2Tests for SchemeLink
3"""
4
5from ...gui import test
6from ...registry.tests import small_testing_registry
7from ...registry import InputSignal, OutputSignal
8
9from .. import SchemeNode, SchemeLink, IncompatibleChannelTypeError
10
11
12class TestSchemeLink(test.QAppTestCase):
13    def test_link(self):
14        import Orange
15        reg = small_testing_registry()
16        base = "Orange.OrangeWidgets"
17        file_desc = reg.widget(base + ".Data.OWFile.OWFile")
18        discretize_desc = reg.widget(base + ".Data.OWDiscretize.OWDiscretize")
19        bayes_desc = reg.widget(base + ".Classify.OWNaiveBayes.OWNaiveBayes")
20
21        file_node = SchemeNode(file_desc)
22        discretize_node = SchemeNode(discretize_desc)
23        bayes_node = SchemeNode(bayes_desc)
24
25        link1 = SchemeLink(file_node, file_node.output_channel("Data"),
26                           discretize_node,
27                           discretize_node.input_channel("Data"))
28
29        self.assertTrue(link1.source_type() is Orange.data.Table)
30        self.assertTrue(link1.sink_type() is Orange.data.Table)
31
32        with self.assertRaises(ValueError):
33            SchemeLink(discretize_node, "Data",
34                       file_node, "$$$[")
35
36        with self.assertRaises(IncompatibleChannelTypeError):
37            SchemeLink(bayes_node, "Learner", discretize_node, "Data")
Note: See TracBrowser for help on using the repository browser.