Best Python code snippet using localstack_python
test_geoip.py
Source:test_geoip.py
...30 def test_no_file(self, raven):31 with self._open_db(raven, filename="") as db:32 assert isinstance(db, geoip.GeoIPNull)33 raven.check(["OSError: No geoip filename specified."])34 def test_open_missing_file(self, raven):35 tmpdir = tempfile.mkdtemp()36 try:37 filename = os.path.join(tmpdir, "not_there")38 with self._open_db(raven, filename) as db:39 assert isinstance(db, geoip.GeoIPNull)40 finally:41 shutil.rmtree(tmpdir)42 raven.check(["FileNotFoundError"])43 def test_open_invalid_file(self, raven):44 with tempfile.NamedTemporaryFile() as temp:45 temp.write(b"Bucephalus")46 temp.seek(0)47 with self._open_db(raven, temp.name) as db:48 assert isinstance(db, geoip.GeoIPNull)...
test_jpeg2kimage.py
Source:test_jpeg2kimage.py
...92 _image = image_format.read(filename)93 self.fail()94 except IOError:95 pass96 def test_open_missing_file(self):97 filename = "___missing_file___.___"98 image_format = jpeg2kimage.Jpeg2KImage()99 try:100 _image = image_format.read(filename)101 self.fail()102 except IOError:103 pass104class TestJpeg2KImage_PIL(TestJpeg2KImage):105 """Test the class format using a specific decoder"""106 def setUp(self):107 if not isPilUsable():108 self.skipTest("PIL is not available or has no support for JPEG2000")109 @classmethod110 def setUpClass(cls):...
test_translator.py
Source:test_translator.py
...71 os.remove(tmp.name)72 def test_encoding_is_latin1(self):73 tracks = parse_m3u(path_to_data_dir('encoding.m3u'), data_dir)74 self.assertEqual([encoded_track], tracks)75 def test_open_missing_file(self):76 tracks = parse_m3u(path_to_data_dir('non-existant.m3u'), data_dir)77 self.assertEqual([], tracks)78 def test_empty_ext_file(self):79 tracks = parse_m3u(path_to_data_dir('empty-ext.m3u'), data_dir)80 self.assertEqual([], tracks)81 def test_basic_ext_file(self):82 tracks = parse_m3u(path_to_data_dir('one-ext.m3u'), data_dir)83 self.assertEqual([song1_ext_track], tracks)84 def test_multi_ext_file(self):85 tracks = parse_m3u(path_to_data_dir('two-ext.m3u'), data_dir)86 self.assertEqual([song1_ext_track, song2_ext_track], tracks)87 def test_ext_file_with_comment(self):88 tracks = parse_m3u(path_to_data_dir('comment-ext.m3u'), data_dir)89 self.assertEqual([song1_ext_track], tracks)...
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!!