Best Python code snippet using avocado_python
test_recipe_models.py
Source:test_recipe_models.py
1from django.core.exceptions import ValidationError2from parameterized import parameterized34from .test_recipe_base import Recipe, RecipeTestBase567class RecipeModelTest(RecipeTestBase):8 def setUp(self) -> None:9 self.recipe = self.make_recipe()10 return super().setUp()1112 def make_recipe_no_defaults(self):13 recipe = Recipe(14 category=self.make_category(name='Test_default_category'),15 author=self.make_author(username='newuser'),16 title="Recipe Title",17 description="Description",18 slug="recipe-slug-2",19 preparation_time=10,20 preparation_time_unit="Minutos",21 servings=5,22 servings_unit="Porçoes",23 preparation_steps="Recipe preparation stps",24 )25 recipe.full_clean()26 recipe.save()27 return recipe2829 @parameterized.expand([30 ('title', 65),31 ('description', 165),32 ('preparation_time_unit', 65),33 ('servings_unit', 65),34 ])35 def test_recipe_model_max_length(self, field, max_length):36 setattr(self.recipe, field, 'A' * (max_length + 1))37 with self.assertRaises(ValidationError):38 self.recipe.full_clean()3940 def test_recipe_preparation_steps_is_html_is_false_by_default(self):41 recipe = self.make_recipe_no_defaults()42 self.assertFalse(recipe.preparation_steps_is_html)4344 def test_recipe_is_publised_is_false_by_default(self):45 recipe = self.make_recipe_no_defaults()46 self.assertFalse(recipe.is_published)4748 def test_recipe_string_representation(self):49 self.recipe.title = 'Testing representation'50 self.recipe.full_clean()51 self.recipe.save()
...
test_zaim_no_auth.py
Source:test_zaim_no_auth.py
...5 def setUp(self):6 self.api = zaim.Api()7 def test_default_account(self):8 self.assertIn('accounts', self.api.default_account().keys())9 def test_default_category(self):10 self.assertIn('categories', self.api.default_category().keys())11 def test_default_genre(self):12 self.assertIn('genres', self.api.default_genre().keys())13 def test_default_currency(self):14 self.assertIn('currencies', self.api.default_currency().keys())15if __name__ == '__main__':...
test_categories.py
Source:test_categories.py
1"""2Testing the biolink model dataclasses + pydandic3"""4from biolink_model_pydantic.model import MolecularEntity5def test_default_category():6 """7 Test that categories are inferred from the mro chain8 """9 molec_entity = MolecularEntity(id='HP:123', type='SO:123')...
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!!