Best Python code snippet using uiautomator
test_adb.py
Source:test_adb.py  
...163            adb = Adb()164            adb.devices = MagicMock()165            adb.devices.return_value = {}166            adb.device_serial()167    def test_forward_list(self):168        adb = Adb()169        adb.version = MagicMock()170        adb.version.return_value = ['1.0.31', '1', '0', '31']171        adb.raw_cmd = MagicMock()172        adb.raw_cmd.return_value.communicate.return_value = (b"014E05DE0F02000E    tcp:9008    tcp:9008\r\n489328DKFL7DF    tcp:9008    tcp:9008", b"")173        self.assertEqual(adb.forward_list(), [['014E05DE0F02000E', 'tcp:9008', 'tcp:9008'], ['489328DKFL7DF', 'tcp:9008', 'tcp:9008']])174        adb.version.return_value = ['1.0.29', '1', '0', '29']175        with self.assertRaises(EnvironmentError):...test_unpack_state.py
Source:test_unpack_state.py  
...42        state = self.reset_state()43        state[torchbearer.Y_PRED] = 144        packer.on_forward_validation(state)45        self.assertTrue(state[torchbearer.Y_PRED] == 1)46    def test_forward_list(self):47        packer = UnpackState(keys=[torchbearer.Y_TRUE])48        state = self.reset_state()49        state[torchbearer.Y_PRED] = [1, 2, 3]50        packer.on_forward(state)51        self.assertTrue(state[torchbearer.Y_PRED] == [1, 2, 3])52        state = self.reset_state()53        state[torchbearer.Y_PRED] = [1, 2, 3]54        packer.on_forward_validation(state)55        self.assertTrue(state[torchbearer.Y_PRED] == [1, 2, 3])56    def test_forward_dict_no_y_pred(self):57        packer = UnpackState(keys=[torchbearer.Y_TRUE])58        state = self.reset_state()59        state[torchbearer.Y_PRED] = {'one': 1, 'two': 2}60        packer.on_forward(state)...SConstruct
Source:SConstruct  
1env = Environment(2	CPPFLAGS=['-std=c++11'],3	CCFLAGS=['-Wall'],4	LIBS=['gtest', 'gtest_main', 'pthread']5)6import os  # pridaj farbu ak pouzivam clang7if 'TERM' in os.environ:8	env['ENV']['TERM'] = os.environ['TERM']9env.Program('test_forward_list.cpp')...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!!
