Exemplo n.º 1
0
 def test_ConvertIngredientInDifferentCategoryBase(self):
     ing = Models.RecipeIngredient(name='Flour', amount='1 1/2', unit='c')
     # convert to grams
     converted = RecipeOperations.RecipeOperations.convertIngredientToUnit(
         ing, 'g')
     convertedAmount = Utilities.convert_to_float(converted.amount)
     self.assertAlmostEqual(180, round(convertedAmount))
Exemplo n.º 2
0
 def test_ConvertIngredientInDifferentCategoryUnit(self):
     ing = Models.RecipeIngredient(name='Flour', amount='10', unit='tbsps')
     # convert to ounces
     converted = RecipeOperations.RecipeOperations.convertIngredientToUnit(
         ing, 'oz')
     convertedAmount = Utilities.convert_to_float(converted.amount)
     self.assertAlmostEqual(2.65, round(convertedAmount, 2))
Exemplo n.º 3
0
 def test_ConvertIngredientInSameCategory(self):
     ing = Models.RecipeIngredient(name='Test Ingredient',
                                   amount='1 1/2',
                                   unit='cups')
     # convert to tbsp
     converted = RecipeOperations.RecipeOperations.convertIngredientToUnit(
         ing, 'tbsp')
     convertedAmount = Utilities.convert_to_float(converted.amount)
     self.assertAlmostEqual(24, round(convertedAmount))