def tool_model(): model = ToolModel() HalNode.hal_pins.clear() HalNode.hal_pins.append(('d_in_1', 'bit', 'IN')) HalNode.hal_pins.append(('d_in_2', 'bit', 'IN')) HalNode.hal_pins.append(('d_in_3', 'bit', 'IN')) HalNode.hal_pins.append(('d_out_1', 'bit', 'OUT')) HalNode.hal_pins.append(('d_out_2', 'bit', 'OUT')) HalNode.hal_pins.append(('d_out_3', 'bit', 'OUT')) HalNode.hal_pins.append(('a_in_1', 's32', 'IN')) HalNode.hal_pins.append(('a_in_2', 'u32', 'IN')) HalNode.hal_pins.append(('a_in_3', 'float', 'IN')) HalNode.hal_pins.append(('a_out_1', 's32', 'OUT')) HalNode.hal_pins.append(('a_out_2', 'u32', 'OUT')) HalNode.hal_pins.append(('a_out_3', 'float', 'OUT')) file = 'tests/tools/basic_tool_1.json' with open(file) as f: json_data = json.load(f) model.loadJSON(json_data) return model
def test_ToolModel_loadJSON(): model = ToolModel() file = 'tests/tools/basic_tool_1.json' with open(file) as f: json_data = json.load(f) model.loadJSON(json_data)
def tool_model(qtbot): model = ToolModel() file = 'tests/tools/basic_tool_1.json' with open(file) as f: json_data = json.load(f) model.loadJSON(json_data) return model
def tool_model(request): model = ToolModel() file = request.param with open(file) as f: json_data = json.load(f) model.loadJSON(json_data) return model
def test_Tool_Model_build_a_tool(): model = ToolModel() root_index = model.index(0, 0, QtCore.QModelIndex()) tool_index = model.insertChild(root_index, strings.TOOL_NODE) sys1_index = model.insertChild(tool_index, strings.SYSTEM_NODE) dev1_index = model.insertChild(sys1_index, strings.DEVICE_NODE) icon = model.insertChild(dev1_index, strings.DEVICE_ICON_NODE) d_in_index = model.insertChild(dev1_index, strings.D_IN_NODE) d_out_index = model.insertChild(dev1_index, strings.D_OUT_NODE) a_in_index = model.insertChild(dev1_index, strings.A_IN_NODE) a_out_index = model.insertChild(dev1_index, strings.A_OUT_NODE) bool_var_index = model.insertChild(dev1_index, strings.BOOL_VAR_NODE) float_var_index = model.insertChild(dev1_index, strings.FLOAT_VAR_NODE)
def tool_model(request): tree = ET.parse(request.param) tool_model = ToolModel() tool_model.loadTool(tree) return tool_model