def _extract_list(self, cells): var = robotapi.Variable(self._controller.datafile.variable_table, '', [self.GetCellValue(*cell) for cell in cells], '') dlg = ListVariableDialog( self._controller.datafile_controller.variables, var, self._plugin) if dlg.ShowModal() == wx.ID_OK: name, value = dlg.get_value() comment = dlg.get_comment() self._execute(ExtractList(name, value, comment, cells))
def test_list_extract(self): row = 0 cols = [2, 3] var_name = '@{joo}' var_value = self.testcase.step(row).as_list()[cols[0]:cols[-1] + 1] value_after_list = self.testcase.step(row).as_list()[cols[-1] + 1] var_comment = ['Comment for my test list'] self.testcase.execute( ExtractList(var_name, var_value, var_comment, [(row, col) for col in cols])) assert_equal(self.testcase.step(row).as_list()[cols[0]], var_name) var = [ var for var in self.testcase.datafile_controller.variables if var.name == var_name ][0] assert_equal(var.value, var_value) assert_equal(var.comment.as_list(), var_comment) assert_equal( self.testcase.step(row).as_list()[cols[0] + 1], value_after_list)