Best Python code snippet using autotest_python
AndoridDataAnalyzer.py
Source:AndoridDataAnalyzer.py
...56 starttimes.append(read_time_from_logcat(_folder, package_name, activity_name))57 # print(starttimes)58 return starttimes59 #60 # def _get_execution_info(self):61 # return self.datasets_map.get('execution_info')62 #63 # def get_header_text(self):64 # return self._get_execution_info().get('header_text')65 #66 # def get_package_name(self):67 # return self._get_execution_info().get('package_name')68 #69 # def get_activity_name(self):70 # return self._get_execution_info().get('activity_name')71 #72 # def get_app_label(self):73 # return self._get_execution_info().get('app_label')74 #75 # def get_counters_list(self):76 # return self.datasets_map[COUNTERS]77 #78 # def get_test_types(self):79 # return self.datasets_map.get('test_types')80 #81 # def get_test_type(self, index):82 # return self.get_test_types()[index]83 #84 # def _get_translations(self):85 # return self.datasets_map.get('translations')86 #87 # def translate(self, item):...
python_executor_operator_test.py
Source:python_executor_operator_test.py
...56 model.name = '{0}.{1}.my_model'.format(57 self._context.pipeline_info.id,58 self._context.pipeline_node.node_info.id)59class PythonExecutorOperatorTest(test_case_utils.TfxTest):60 def _get_execution_info(self, input_dict, output_dict, exec_properties):61 pipeline_node = pipeline_pb2.PipelineNode(node_info={'id': 'MyPythonNode'})62 pipeline_info = pipeline_pb2.PipelineInfo(id='MyPipeline')63 stateful_working_dir = os.path.join(self.tmp_dir, 'stateful_working_dir')64 executor_output_uri = os.path.join(self.tmp_dir, 'executor_output')65 return data_types.ExecutionInfo(66 execution_id=1,67 input_dict=input_dict,68 output_dict=output_dict,69 exec_properties=exec_properties,70 stateful_working_dir=stateful_working_dir,71 execution_output_uri=executor_output_uri,72 pipeline_node=pipeline_node,73 pipeline_info=pipeline_info,74 pipeline_run_id=99)75 def testRunExecutor_with_InprocessExecutor(self):76 executor_sepc = text_format.Parse(77 """78 class_path: "tfx.orchestration.portable.python_executor_operator_test.InprocessExecutor"79 """, executable_spec_pb2.PythonClassExecutableSpec())80 operator = python_executor_operator.PythonExecutorOperator(executor_sepc)81 input_dict = {'input_key': [standard_artifacts.Examples()]}82 output_dict = {'output_key': [standard_artifacts.Model()]}83 exec_properties = {'key': 'value'}84 executor_output = operator.run_executor(85 self._get_execution_info(input_dict, output_dict, exec_properties))86 self.assertProtoPartiallyEquals(87 """88 execution_properties {89 key: "key"90 value {91 string_value: "value"92 }93 }94 output_artifacts {95 key: "output_key"96 value {97 artifacts {98 }99 }100 }""", executor_output)101 def testRunExecutor_with_NotInprocessExecutor(self):102 executor_sepc = text_format.Parse(103 """104 class_path: "tfx.orchestration.portable.python_executor_operator_test.NotInprocessExecutor"105 """, executable_spec_pb2.PythonClassExecutableSpec())106 operator = python_executor_operator.PythonExecutorOperator(executor_sepc)107 input_dict = {'input_key': [standard_artifacts.Examples()]}108 output_dict = {'output_key': [standard_artifacts.Model()]}109 exec_properties = {'key': 'value'}110 executor_output = operator.run_executor(111 self._get_execution_info(input_dict, output_dict, exec_properties))112 self.assertProtoPartiallyEquals(113 """114 execution_properties {115 key: "key"116 value {117 string_value: "value"118 }119 }120 output_artifacts {121 key: "output_key"122 value {123 artifacts {124 }125 }126 }""", executor_output)127 def testRunExecutor_with_InplaceUpdateExecutor(self):128 executor_sepc = text_format.Parse(129 """130 class_path: "tfx.orchestration.portable.python_executor_operator_test.InplaceUpdateExecutor"131 """, executable_spec_pb2.PythonClassExecutableSpec())132 operator = python_executor_operator.PythonExecutorOperator(executor_sepc)133 input_dict = {'input_key': [standard_artifacts.Examples()]}134 output_dict = {'output_key': [standard_artifacts.Model()]}135 exec_properties = {136 'string': 'value',137 'int': 1,138 'float': 0.0,139 # This should not happen on production and will be140 # dropped.141 'proto': execution_result_pb2.ExecutorOutput()142 }143 executor_output = operator.run_executor(144 self._get_execution_info(input_dict, output_dict, exec_properties))145 self.assertProtoPartiallyEquals(146 """147 execution_properties {148 key: "float"149 value {150 double_value: 0.0151 }152 }153 execution_properties {154 key: "int"155 value {156 int_value: 1157 }158 }...
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!!