예제 #1
0
 def test_set_all_ingredients(self):
     recipe = Recipe()
     recipe.ingredients = [
         {"heading": False, "text": "Sugar"},
         {"heading": False, "text": "Butter"},
         {"heading": False, "text": "Milk"},
         ]
     self.assertEqual("Sugar\nButter\nMilk", recipe.raw_ingredients)
예제 #2
0
 def test_set_with_heading_marker_in_text(self):
     recipe = Recipe()
     
     recipe.ingredients = [
         {"heading": False, "text": "Sugar|Treacle"},
         {"heading": False, "text": "Butter"},
         {"heading": False, "text": "Milk"},
         ]
     self.assertEqual("Sugar|Treacle\nButter\nMilk", recipe.raw_ingredients)
예제 #3
0
 def test_set_heading(self):
     recipe = Recipe()
     recipe.ingredients = [
         {"heading": True, "text": "For the batter"},
         {"heading": False, "text": "Butter"},
         {"heading": False, "text": "Milk"},
         {"heading": True, "text": "Another"},
         ]
     self.assertEqual(
         "|For the batter\nButter\nMilk\n|Another", recipe.raw_ingredients)
예제 #4
0
 def test_set_empty(self):
     recipe = Recipe()
     recipe.ingredients = []
     self.assertEqual("", recipe.raw_ingredients)