class MealTest(unittest.TestCase): def setUp(self): self.name = 'Chicken with vegetables' self.carbo = 55 self.fat = 8 self.protein = 27 self.meal = Meal(self.name, self.carbo, self.fat, self.protein) def test_get_name(self): self.assertEqual(self.meal.get_name(), self.name) def test_get_carbo(self): self.assertEqual(self.meal.get_carbo(), self.carbo) def test_get_fat(self): self.assertEqual(self.meal.get_fat(), self.fat) def test_get_protein(self): self.assertEqual(self.meal.get_protein(), self.protein)
def test_calculate_bolus_in_the_evening(self): expected_bolus = round(2.25, 1) expected_extended_bolus = 0.4 # fruits, seeds meal = Meal('fruits', 18, 5, 3) bg_state = self.dm.get_blood_glucose_manager().create_bg_state( self.person, 100, 17) bolus = self.dm.get_bolus_manager().calculate_bolus(bg_state, meal) self.assertEqual(bolus.get_value(), expected_bolus) self.assertEqual(bolus.get_extended_value(), expected_extended_bolus)
def test_calculate_bolus_in_the_morning(self): expected_bolus = 4.8 expected_extended_bolus = 0.8 # bread, cheese, pineapple meal = Meal('breakfast', 43, 12, 9) bg_state = self.dm.get_blood_glucose_manager().create_bg_state( self.person, 100, 9) bolus = self.dm.get_bolus_manager().calculate_bolus(bg_state, meal) self.assertEqual(bolus.get_value(), expected_bolus) self.assertEqual(bolus.get_extended_value(), expected_extended_bolus)
def test_calculate_bolus(self): expected_bolus = 6.9 expected_extended_bolus = 1.1 # chicken, pineapple, pepper, rise, olive oil meal = Meal('chicken', 55, 8, 27) bg_state = self.dm.get_blood_glucose_manager().create_bg_state( self.person, 100, 14) bolus = self.dm.get_bolus_manager().calculate_bolus(bg_state, meal) self.assertEqual(bolus.get_value(), expected_bolus) self.assertEqual(bolus.get_extended_value(), expected_extended_bolus)
def setUp(self): self.name = 'Chicken with vegetables' self.carbo = 55 self.fat = 8 self.protein = 27 self.meal = Meal(self.name, self.carbo, self.fat, self.protein)