Best Python code snippet using autotest_python
source_unittest.py
Source:source_unittest.py
...216 self.addinfourl_mock = self.god.create_mock_class(217 source.urllib2.addinfourl, 'addinfourl')218 self.mime_mock = self.god.create_mock_class(219 httplib.HTTPMessage, 'HTTPMessage')220 def test_get_new_files(self):221 # record222 (source.urllib2.urlopen.expect_call(self._full_path1)223 .and_return(cStringIO.StringIO(self._output1)))224 for link, size, time in self._extracted_links1:225 (source.urllib2.urlopen.expect_call(link)226 .and_return(self.addinfourl_mock))227 self.addinfourl_mock.info.expect_call().and_return(self.mime_mock)228 self.mime_mock.get.expect_call('content-length').and_return(size)229 self.mime_mock.getdate.expect_call('date').and_return(time)230 (source.urllib2.urlopen.expect_call(self._full_path2)231 .and_return(cStringIO.StringIO(self._output2)))232 for link, size, time in self._extracted_links2:233 (source.urllib2.urlopen.expect_call(link)234 .and_return(self.addinfourl_mock))...
test_file_utils.py
Source:test_file_utils.py
...30from unittest2 import TestCase31from unittest2.util import unorderable_list_difference32from merlin.fs.utils import FileUtils, FileDescriptor33class TestFileUtils(TestCase):34 def test_get_new_files(self):35 self.assertGetNewFiles(36 left=[],37 right=[],38 expected_seq=[],39 scenario_name="empty lists"40 )41 self.assertGetNewFiles(42 left=["file001.txt"],43 right=[],44 expected_seq=["file001.txt"],45 scenario_name="new file"46 )47 self.assertGetNewFiles(48 left=[],...
test_countFiles.py
Source:test_countFiles.py
...17 def test_rows_in_csv(self):18 test_path = '/Users/ingowie/scripts/db/'19 expected = 1420 self.assertEqual(len(get_rows_in_csv(test_path)), expected)21 def test_get_new_files(self):22 test_path = '/Users/ingowie/scripts/db/'23 file_objects = get_files('/Users/ingowie/Scripts')24 csv_objects = get_rows_in_csv(test_path)25 new_files = get_new_files(csv_objects,file_objects)26 expected = 227 self.assertEqual(len(new_files),expected)28 29if __name__ == "__main__":...
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!!