Best Python code snippet using avocado_python
test_client.py
Source:test_client.py  
...106        DUMMY_PROOF = 'dummy proof'107        DUMMY_UID = 'dummy uid'108        when(child_chain).get_proof(DUMMY_BLOCK_NUM, DUMMY_UID).thenReturn(DUMMY_PROOF)109        assert client.get_proof(DUMMY_BLOCK_NUM, DUMMY_UID) == DUMMY_PROOF110    def test_start_exit(self, client, root_chain):111        MOCK_PREVIOUS_BLOCK = mock()112        MOCK_BLOCK = mock()113        DUMMY_PREVIOUS_TX = 'dummy previous tx'114        DUMMY_ENCODED_PREVIOUS_TX = 'dummy encoded previous tx'115        DUMMY_PREVIOUS_TX_PROOF = 'dummy previous tx proof'116        DUMMY_PREVIOUS_TX_BLK_NUM = 'dummy previous tx blk num'117        DUMMY_TX = 'dummy tx'118        DUMMY_ENCODED_TX = 'dummy encoded tx'119        DUMMY_TX_PROOF = 'dummy tx proof'120        DUMMY_TX_BLK_NUM = 'dummy tx blk num'121        DUMMY_UID = 'dummy uid'122        when(root_chain.functions).startExit(123            DUMMY_ENCODED_PREVIOUS_TX,124            DUMMY_PREVIOUS_TX_PROOF,...test_get_target_positions.py
Source:test_get_target_positions.py  
...80        expected = pd.DataFrame([81            ['BTC', 0.01],82        ], columns=['symbol', 'position']).set_index('symbol')83        assert_frame_equal(df, expected)84    def test_start_exit(self):85        df = self.executor.get_target_positions(86            timestamp=execution_start_at + day_seconds87        )88        expected = pd.DataFrame([89            ['BTC', 0.01],90        ], columns=['symbol', 'position']).set_index('symbol')91        assert_frame_equal(df, expected)92    def test_finish_exit(self):93        df = self.executor.get_target_positions(94            timestamp=execution_start_at + day_seconds + self.execution_time95        )96        expected = pd.DataFrame([97        ], columns=['symbol', 'position']).set_index('symbol')98        expected['position'] = expected['position'].astype(float)...thread_test.py
Source:thread_test.py  
...8        subscriber = Subscriber(channel, callback_mock)9        self.thread = SubscriberThread(subscriber=subscriber, errorevent=None)10    def test_stop_is_false(self):11        self.assertFalse(self.thread._stopevent.is_set())12    def test_start_exit(self):13        self.thread.start()14        try:15            self.assertTrue(self.thread.is_alive())16            self.assertFalse(self.thread._stopevent.is_set())17        except RuntimeError:18            raise19        finally:20            self.thread.exit()21        self.assertFalse(self.thread.is_alive())22        self.assertTrue(self.thread._stopevent.is_set())23    def test_run_callback(self):24        self.thread.start()25        data = "data"26        self.thread.subscriber.channel.publish(data)...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!!
