How to use merge_description method in tox

Best Python code snippet using tox_python

project_task_merge_wizard.py

Source:project_task_merge_wizard.py Github

copy

Full Screen

...11 @api.multi12 def merge_tasks(self):13 values = {14 'user_id': self.user_id.id,15 'description': self.merge_description(),16 }17 if self.create_new_task:18 values.update({19 'name': self.target_task_name,20 'project_id': self.target_project_id.id21 })22 self.target_task_id = self.env['project.task'].create(values)23 else:24 self.target_task_id.write(values)25 self.merge_followers()26 self.target_task_id.message_post_with_view(27 self.env.ref('project.mail_template_task_merge'),28 values={'target': True, 'tasks': self.task_ids - self.target_task_id},29 subtype_id=self.env.ref('mail.mt_comment').id30 )31 (self.task_ids - self.target_task_id).message_post_with_view(32 self.env.ref('project.mail_template_task_merge'),33 values={'target': False, 'task': self.target_task_id},34 subtype_id=self.env.ref('mail.mt_comment').id35 )36 (self.task_ids - self.target_task_id).write({'active': False})37 return {38 "type": "ir.actions.act_window",39 "res_model": "project.task",40 "views": [[False, "form"]],41 "res_id": self.target_task_id.id,42 }43 @api.multi44 def merge_description(self):45 return '<br/>'.join(self.task_ids.mapped(lambda task: "Description from task <b>%s</b>:<br/>%s" % (task.name, task.description or 'No description')))46 @api.multi47 def merge_followers(self):48 self.target_task_id.message_subscribe(49 partner_ids=(self.task_ids - self.target_task_id).mapped('message_partner_ids').ids,50 channel_ids=(self.task_ids - self.target_task_id).mapped('message_channel_ids').ids,51 )52 @api.model53 def default_get(self, fields):54 result = super(ProjectTaskMergeWizard, self).default_get(fields)55 selected_tasks = self.env['project.task'].browse(self.env.context.get('active_ids', False))56 assigned_tasks = selected_tasks.filtered(lambda task: task.user_id)57 result.update({58 'task_ids': selected_tasks.ids,...

Full Screen

Full Screen

listr.py

Source:listr.py Github

copy

Full Screen

1import getpass2import re3def merge_description(li, str=''):4 for i in range(len(li)):5 str = str+'_'+li[i]6 return str[1:]7def final_li(all_result_list, splitstr, tc_list, tc_full_list):8 for item in all_result_list:9 tc_list.append(item[len(splitstr):])10 none_preconditioncode = []11 for i in tc_list:12 if len(i.split(splitstr)) < 5:13 print('>>> Dump: %s\n Reason: Route too short' % (i))14 elif '#' in i:15 print('>>> Dump: %s\n Reason: Manually Abandoned' % (i))16 else:17 tmpli = []18 # 功能路径19 tc_funcpath = i.split(splitstr)[:1]20 # 功能点21 tc_point = i.split(splitstr)[1:2]22 # 功能说明23 tc_description = i.split(splitstr)[2:-3]24 # 来源25 tc_source = '需求文档'26 # 前置条件27 try:28 tc_preconditions = i.split(splitstr)[-3]29 except IndexError as e:30 print(e)31 # 匹配单个大写或小写字母、一个或两个数字、一个字母和一个数字组合、一个数字和字母组合32 if re.match('^[a-zA-Z]{1}$|^[0-9]{1,2}$|^[a-zA-z]{1}[0-9]{1}$|^[0-9]{1}[a-zA-z]{1}$', i.split(splitstr)[-3]):33 if len(i.split(splitstr)[-3]) < 2:34 tc_preconditions = '%s0数据准备:无' % (i.split(splitstr)[-3])35 else:36 tc_preconditions = '%s数据准备:无' % (i.split(splitstr)[-3])37 # elif i.split(splitstr)[-3] == '无':38 # tc_preconditions = '数据准备:无'39 else:40 tc_preconditions = '数据准备:%s' % (i.split(splitstr)[-3])41 # input42 tc_input = 'input: %s' % (i.split(splitstr)[-2])43 # output44 tc_output = 'output: %s' % (i.split(splitstr)[-1])45 # 用例级别46 # TODO 获取脑图中的用例级别47 tc_level = '0级'48 # 用例责任人49 tc_tester = getpass.getuser()50 # 适用版本51 tc_version = 'v3.0'52 tmpli.append(tc_funcpath[0])53 tmpli.append(tc_point[0])54 tmpli.append(merge_description(tc_description))55 tmpli.append(tc_source)56 tmpli.append(tc_preconditions)57 tmpli.append(tc_input)58 tmpli.append(tc_output)59 tmpli.append(tc_level)60 tmpli.append(tc_tester)61 tmpli.append(tc_version)62 tc_full_list.append(tmpli)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tox automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful