Best Python code snippet using autotest_python
source_unittest.py
Source:source_unittest.py  
...284        s = source.directory_source(self.db_mock, path)285        expected = {'file2': source.database.item(file2_full_path, 1010, 123)}286        self.assertEquals(expected, s.get_new_files(_stat_func=self._stat_mock))287        self.god.check_playback()288    def test_get_new_files_success(self):289        """290        Test directory_source.get_new_files() success.291        """292        path = '/some/valid/path'293        file1_full_path = os.path.join(path, 'file1')294        file2_full_path = os.path.join(path, 'file2')295        file3_full_path = os.path.join(path, 'file3')296        os.listdir.expect_call(path).and_return(['file1', 'file2', 'file3'])297        stat_result = self._get_stat_result(size=1010, mtime=123)298        self._stat_mock.expect_call(file1_full_path).and_return(stat_result)299        stat_result = self._get_stat_result(size=1020, mtime=1234)300        self._stat_mock.expect_call(file2_full_path).and_return(stat_result)301        stat_result = self._get_stat_result(size=1030, mtime=12345)302        self._stat_mock.expect_call(file3_full_path).and_return(stat_result)...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!!
