def test_init(self): model = Port() self.assertEqual(model.is_input(), False) model.conn_type = Port.INPUT self.assertEqual(model.is_input(), True) model.conn_type = Port.OUTPUT self.assertEqual(model.is_input(), False)
def create_block(self, diagram_control=None): if diagram_control is None: diagram_control = self.create_diagram_control() block_model = BlockModel() port0 = Port() port0.label = "Test0" port0.conn_type = Port.OUTPUT port0.name = "Test0" port0.type = "Test" port1 = Port() port1.label = "Test1" port1.conn_type = Port.INPUT port1.name = "Test1" port1.type = "Test" block_model.ports = [port0, port1] block_model.help = "Test" block_model.label = "Test" block_model.color = "200:200:25:150" block_model.group = "Test" block_model.codes = {"code0":"Test", "Code1":"Test", "Code2":"Test"} block_model.type = "Test" block_model.maxIO = 2 block_model.language = "language" block_model.properties = [{"name": "test", "label": "Test", "type": MOSAICODE_FLOAT }] block_model.extension = "Test" block_model.file = None block = Block(diagram_control.diagram, block_model) return block