def main(feet=None): log.init() meters = utils.feet_to_meters(feet) if meters is not None: click.echo(meters)
def when_string(): expect(utils.feet_to_meters("hello")) == None
## def get_fat_macro(lbm_percent): return (xrange(60,95), xrange(40,65)) ## # Carbs, it's a filler ## def get_carb_macro(prot_macro, fat_macro, calorie_tuple): # tuple should come as (rest day calories, train day calories) rest_carb_calorie = calorie_tuple[0] - prot_macro[0]*4 - fat_macro[0]*9 train_carb_calorie = calorie_tuple[1] - prot_macro[1]*4 - fat_macro[1]*9 return (rest_carb_calorie/4, train_carb_calorie/4) if __name__ == '__main__': height = feet_to_meters(feet=5, inches=6.5) weight = lbs_to_kg(154) print "Weight: %s Height: %s" % (weight, height) lbm = 20 base_bmr = get_bmr(gender='male', weight=weight, height=height, age=24) adj_bmr = get_adjusted_bmr(bmr=base_bmr, activity_level=ActivityLevel.sedentary) kcal_num = get_calorie_targets(adj_bmr, Stage.cut) protein_macro = get_protein_macro(lbm, weight, Stage.cut) fat_macro_range = get_fat_macro(lbm) rest_range = [i for i in fat_macro_range[0]] workout_range = [i for i in fat_macro_range[1]] fat_macro_rest = raw_input("Pick fat macro (Rest): (%s - %s)\n->" % (rest_range[1], rest_range[-1]))
def when_integer(): expect(utils.feet_to_meters(42)) == 12.80165
def test_invalid_inputs_are_handled(self): self.assertEqual(utils.feet_to_meters("hello"), None)
return (xrange(60, 95), xrange(40, 65)) ## # Carbs, it's a filler ## def get_carb_macro(prot_macro, fat_macro, calorie_tuple): # tuple should come as (rest day calories, train day calories) rest_carb_calorie = calorie_tuple[0] - prot_macro[0] * 4 - fat_macro[0] * 9 train_carb_calorie = calorie_tuple[1] - prot_macro[1] * 4 - fat_macro[1] * 9 return (rest_carb_calorie / 4, train_carb_calorie / 4) if __name__ == '__main__': height = feet_to_meters(feet=5, inches=6.5) weight = lbs_to_kg(154) print "Weight: %s Height: %s" % (weight, height) lbm = 20 base_bmr = get_bmr(gender='male', weight=weight, height=height, age=24) adj_bmr = get_adjusted_bmr(bmr=base_bmr, activity_level=ActivityLevel.sedentary) kcal_num = get_calorie_targets(adj_bmr, Stage.cut) protein_macro = get_protein_macro(lbm, weight, Stage.cut) fat_macro_range = get_fat_macro(lbm) rest_range = [i for i in fat_macro_range[0]] workout_range = [i for i in fat_macro_range[1]]
def test_conversion_is_correct(self): self.assertEqual(utils.feet_to_meters(42), 12.80165)
def test_feet_to_meters(self): ret = feet_to_meters(feet=2, inches=3) self.assertTrue(int(ret) == 68) ret = feet_to_meters(feet=4, inches=1) self.assertTrue(int(ret) == 124)
def calculate(self, event=None): log.debug("Event: %s", event) meters = utils.feet_to_meters(self.feet.get()) if meters is not None: self.meters.set(str(meters))