Best Python code snippet using tavern
test_utils.py
Source:test_utils.py
...42 destination_field_name='thumbnail',43 transformation=lambda file: file44 )45 assert instance_larger_thumb.thumbnail.width == instance_larger_thumb.image.width46 def test_path_correct(self, instance):47 simpleimages.utils.transform_field(48 instance=instance,49 source_field_name='image',50 destination_field_name='thumbnail',51 transformation=lambda file: file52 )53 original_name = instance.image.name.split('/')[-1]54 new_path = 'thumbnails/' + original_name55 assert instance.thumbnail.name == new_path56class TestPerformTransformation:57 def test_all_fields(self, instance):58 simpleimages.utils.perform_transformation(instance)59 assert instance.thumbnail60 def test_one_field_transforms(self, instance):...
test_core.py
Source:test_core.py
...51 start = (1,1)52 end = (3,4)53 self.assertEqual(round(self.test_core.heuristic_method(start,end, 0),3), 3.828) 54 55 def test_path_correct(self):56 end = (3,4)57 parent = {(1,1): None, (2,1): (1,1), (2,3): (2,1), (3,4): (2,3)}58 self.assertEqual(self.test_core.get_path(end, parent),[(1,1),(2,1),(2,3),(3,4)])59 60 def test_path_start_point_missing(self):61 end = (3,4)62 parent = {(1,1): None, (2,1): (0,1), (2,3): (2,1), (3,4): (2,3)}...
test_call_run.py
Source:test_call_run.py
...23 with pytest.warns(None) as warn_rec:24 run("", **kw)25 assert not len(warn_rec)26class TestParseGlobalCfg:27 def test_path_correct(self):28 run("", tavern_global_cfg=__file__)29 def test_pass_dict(self):30 run("", tavern_global_cfg={"variables": {"a": 1}})31class TestParseFailures:32 @pytest.fixture(autouse=True)33 def patch_pytest(self):34 with patch("tavern.core.pytest.main") as fake_main:35 yield36 assert not fake_main.called37 def test_path_nonexistent(self):38 with pytest.raises(exceptions.InvalidSettingsError):39 run("", tavern_global_cfg="sdfsdd")40 def test_bad_type(self):41 with pytest.raises(exceptions.InvalidSettingsError):...
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!!