def test_init(self): with patch("orangewidget.utils.signals._Signal.get_flags", return_value=42) as getflags: signal = Input("a name", int, "an id", "a doc", ["x"]) self.assertEqual(signal.name, "a name") self.assertEqual(signal.type, int) self.assertEqual(signal.id, "an id") self.assertEqual(signal.doc, "a doc") self.assertEqual(signal.replaces, ["x"]) self.assertEqual(signal.flags, 42) getflags.assert_called_with(False, False, False, False) Input("a name", int, "an id", "a doc", ["x"], multiple=True) getflags.assert_called_with(True, False, False, False) Input("a name", int, "an id", "a doc", ["x"], default=True) getflags.assert_called_with(False, True, False, False) Input("a name", int, "an id", "a doc", ["x"], explicit=True) getflags.assert_called_with(False, False, True, False)
def test_decorate(self): input = Input("a name", int) self.assertEqual(input.handler, "") @input def foo(): pass self.assertEqual(input.handler, "foo") with self.assertRaises(ValueError): @input def bar(): pass
class Inputs: """ Inputs """ streams = Input("Streams", StreamInlet)
class Inputs: data = Input("Data", Table, doc="Input data table")
class Inputs: network = Input("Network", Network, default=True)
class Inputs: input_1 = Input("1", int) input_2 = Input("2", int) input_3 = Input("3", int) input_a = Input("a", object)
class Inputs: an_input = Input("a name", int)
class Inputs: data = Input("数据(Data)", Table, doc="Input data table", replaces=['Data'])
class Inputs: data = Input("Data", Table)
class Inputs: """ Inputs """ pre_node = Input("Pre-Node", Table) post_node = Input("Post-Node", Table)
class Inputs: """ Inputs """ gaze_data = Input("Gaze Data", Table)