Best Python code snippet using autotest_python
action_common.py
Source:action_common.py
...37#38class atest_list(topic_common.atest):39 """atest <topic> list"""40 usage_action = 'list'41 def _convert_wildcard(self, old_key, new_key,42 value, filters, check_results):43 filters[new_key] = value.rstrip('*')44 check_results[new_key] = None45 del filters[old_key]46 del check_results[old_key]47 def _convert_name_wildcard(self, key, value, filters, check_results):48 if value.endswith('*'):49 # Could be __name, __login, __hostname50 new_key = key + '__startswith'51 self._convert_wildcard(key, new_key, value, filters, check_results)52 def _convert_in_wildcard(self, key, value, filters, check_results):53 if value.endswith('*'):54 assert key.endswith('__in'), 'Key %s does not end with __in' % key55 new_key = key.replace('__in', '__startswith', 1)56 self._convert_wildcard(key, new_key, value, filters, check_results)57 def check_for_wildcard(self, filters, check_results):58 """Check if there is a wilcard (only * for the moment)59 and replace the request appropriately"""60 for (key, values) in filters.iteritems():61 if isinstance(values, types.StringTypes):62 self._convert_name_wildcard(key, values,63 filters, check_results)64 continue65 if isinstance(values, types.ListType):66 if len(values) == 1:67 self._convert_in_wildcard(key, values[0],68 filters, check_results)69 continue70 for value in values:...
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!!