コード例 #1
0
 def test_macronutrient_percent_raises_value_error(self, fat_percent,
                                                   carb_percent,
                                                   protein_percent):
     with pytest.raises(ValueError, message="Expected ValueError"):
         meal_maker.MakeMeal(150,
                             body_type=None,
                             fat_percent=fat_percent,
                             carb_percent=carb_percent,
                             protein_percent=protein_percent)
コード例 #2
0
    def test_make_meal(self, weight, meals, body_type, activity_level, goal,
                       min_cal, max_cal, fat_percent, carb_percent,
                       protein_percent, expected):

        assert meal_maker.MakeMeal(
            weight,
            body_type=body_type,
            activity_level=activity_level,
            goal=goal,
            min_cal=min_cal,
            max_cal=max_cal,
            fat_percent=fat_percent,
            carb_percent=carb_percent,
            protein_percent=protein_percent).make_meal(meals) == expected
コード例 #3
0
    def test_daily_requirements(self, weight, body_type, activity_level, goal,
                                min_cal, max_cal, fat_percent, carb_percent,
                                protein_percent, expected):

        assert meal_maker.MakeMeal(
            weight,
            body_type=body_type,
            activity_level=activity_level,
            goal=goal,
            min_cal=min_cal,
            max_cal=max_cal,
            fat_percent=fat_percent,
            carb_percent=carb_percent,
            protein_percent=protein_percent).daily_requirements() == expected
コード例 #4
0
 def test_check_min_cal_raises_type_error(self, type_error_cal):
     with pytest.raises(TypeError, message="Expected TypeError"):
         meal_maker.MakeMeal(150,
                             body_type='mesomorph',
                             min_cal=type_error_cal)
コード例 #5
0
 def test_check_max_cal_raises_value_error(self, value_error_cal):
     with pytest.raises(ValueError, message="Expected ValueError"):
         meal_maker.MakeMeal(150,
                             body_type='mesomorph',
                             max_cal=value_error_cal)
コード例 #6
0
 def test_set_optimum_calories_raises_value_error(self, activity_level,
                                                  goal):
     with pytest.raises(ValueError, message="Expected ValueError"):
         meal_maker.MakeMeal(150, activity_level=activity_level, goal=goal)
コード例 #7
0
 def test_check_weight_value_error(self, value_error_check_weight):
     with pytest.raises(ValueError, message="Expected Value Error"):
         meal_maker.MakeMeal(value_error_check_weight)
コード例 #8
0
 def test_check_weight_type_error(self, type_error_check_weight):
     with pytest.raises(TypeError, message="Expected TypeError"):
         meal_maker.MakeMeal(type_error_check_weight)
コード例 #9
0
 def test_expected_max_cal(self, body_type, activity_level, goal,
                           expected_max_cal):
     assert meal_maker.MakeMeal(150,
                                body_type=body_type,
                                activity_level=activity_level,
                                goal=goal).max_cal == expected_max_cal
コード例 #10
0
 def test_carb_percent(self, body_type, expected):
     assert meal_maker.MakeMeal(
         150, body_type=body_type).carb_percent == expected
コード例 #11
0
 def test_body_type_raises_value_error(self, value_error_body_type):
     with pytest.raises(ValueError, message="Expected ValueError"):
         meal_maker.MakeMeal(150, body_type=value_error_body_type)