Best Python code snippet using tox_python
project_task_merge_wizard.py
Source: project_task_merge_wizard.py
...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,...
listr.py
Source: listr.py
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)...
Check out the latest blogs from LambdaTest on this topic:
I was once asked at a testing summit, “How do you manage a QA team using scrum?” After some consideration, I realized it would make a good article, so here I am. Understand that the idea behind developing software in a scrum environment is for development teams to self-organize.
The web paradigm has changed considerably over the last few years. Web 2.0, a term coined way back in 1999, was one of the pivotal moments in the history of the Internet. UGC (User Generated Content), ease of use, and interoperability for the end-users were the key pillars of Web 2.0. Consumers who were only consuming content up till now started creating different forms of content (e.g., text, audio, video, etc.).
Mobile devices and mobile applications – both are booming in the world today. The idea of having the power of a computer in your pocket is revolutionary. As per Statista, mobile accounts for more than half of the web traffic worldwide. Mobile devices (excluding tablets) contributed to 54.4 percent of global website traffic in the fourth quarter of 2021, increasing consistently over the past couple of years.
Even though several frameworks are available in the market for automation testing, Selenium is one of the most renowned open-source frameworks used by experts due to its numerous features and benefits.
JUnit is one of the most popular unit testing frameworks in the Java ecosystem. The JUnit 5 version (also known as Jupiter) contains many exciting innovations, including support for new features in Java 8 and above. However, many developers still prefer to use the JUnit 4 framework since certain features like parallel execution with JUnit 5 are still in the experimental phase.
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!