Пример #1
0
 def test_calculate_weight_ranges_with_info_lang(self):
     self.assertEqual(Bmi.calculate_weight_ranges_with_info(1.80, "es"), [
         {
             'From': 0,
             'To': 59.9,
             'Info': 'Bajo peso'
         },
         {
             'From': 59.9,
             'To': 81,
             'Info': 'Peso saludable'
         },
         {
             'From': 81,
             'To': 97.2,
             'Info': 'Sobrepeso'
         },
         {
             'From': 97.2,
             'To': 113.4,
             'Info': 'Obesidad, Clase I'
         },
         {
             'From': 113.4,
             'To': 129.6,
             'Info': 'Obesidad, Clase II'
         },
         {
             'From': 129.6,
             'To': "",
             'Info': 'Obesidad, Clase III'
         },
     ])
Пример #2
0
 def test_get_bmi_ranges_with_info_lang(self):
     self.assertEqual(Bmi.get_bmi_ranges_with_info("es"), [
         {
             'From': 0,
             'To': 18.5,
             'Info': 'Bajo peso'
         },
         {
             'From': 18.5,
             'To': 25,
             'Info': 'Peso saludable'
         },
         {
             'From': 25,
             'To': 30,
             'Info': 'Sobrepeso'
         },
         {
             'From': 30,
             'To': 35,
             'Info': 'Obesidad, Clase I'
         },
         {
             'From': 35,
             'To': 40,
             'Info': 'Obesidad, Clase II'
         },
         {
             'From': 40,
             'To': "",
             'Info': 'Obesidad, Clase III'
         },
     ])
Пример #3
0
 def test_get_bmi_ranges_with_info(self):
     self.assertEqual(Bmi.get_bmi_ranges_with_info(), [
         {
             'From': 0,
             'To': 18.5,
             'Info': 'Underweight'
         },
         {
             'From': 18.5,
             'To': 25,
             'Info': 'Healthy'
         },
         {
             'From': 25,
             'To': 30,
             'Info': 'Overweight'
         },
         {
             'From': 30,
             'To': 35,
             'Info': 'Obese, Class I'
         },
         {
             'From': 35,
             'To': 40,
             'Info': 'Obese, Class II'
         },
         {
             'From': 40,
             'To': "",
             'Info': 'Obese, Class III'
         },
     ])
Пример #4
0
 def test_calculate_weight_ranges_with_info(self):
     self.assertEqual(Bmi.calculate_weight_ranges_with_info(1.80), [
         {
             'From': 0,
             'To': 59.9,
             'Info': 'Underweight'
         },
         {
             'From': 59.9,
             'To': 81,
             'Info': 'Healthy'
         },
         {
             'From': 81,
             'To': 97.2,
             'Info': 'Overweight'
         },
         {
             'From': 97.2,
             'To': 113.4,
             'Info': 'Obese, Class I'
         },
         {
             'From': 113.4,
             'To': 129.6,
             'Info': 'Obese, Class II'
         },
         {
             'From': 129.6,
             'To': "",
             'Info': 'Obese, Class III'
         },
     ])
Пример #5
0
 def test_calculate_bmi_obese_93_171(self):
     self.assertEqual(Bmi.calculate_bmi(93, 1.71), 31.8,
                      "Body Mass Index for 93kg and 1.71m is 31.8")
Пример #6
0
 def test_get_bmi_range_info_over(self):
     self.assertEqual(Bmi.get_bmi_range_info(25.3), "Overweight")
Пример #7
0
 def test_calculate_weight_boundaries(self):
     self.assertEqual(Bmi.calculate_weight_boundaries(1.80),
                      [0, 59.9, 81, 97.2, 113.4, 129.6])
Пример #8
0
def execute_get_bmi_range_info(args):
    if args.lang:
        return Bmi.get_bmi_range_info(args.bmi[0], args.lang)
    else:
        return Bmi.get_bmi_range_info(args.bmi[0])
Пример #9
0
 def test_get_bmi_range_info_under(self):
     self.assertEqual(Bmi.get_bmi_range_info(17), "Underweight")
Пример #10
0
 def test_get_bmi_range_info_obese3(self):
     self.assertEqual(Bmi.get_bmi_range_info(46), "Obese, Class III")
Пример #11
0
 def test_calculate_bmi_equal_64_164(self):
     self.assertEqual(Bmi.calculate_bmi(64, 1.64), 23.8,
                      "Body Mass Index for 64kg and 1.64m is 23.8")
Пример #12
0
 def test_get_bmi_range_info_obese1(self):
     self.assertEqual(Bmi.get_bmi_range_info(30.1), "Obese, Class I")
Пример #13
0
def execute_calculate_bmi(args):
    if args.info:
        return Bmi.calculate_bmi_with_info(args.weight[0], args.height[0],
                                           args.info)
    else:
        return Bmi.calculate_bmi(args.weight[0], args.height[0])
Пример #14
0
def execute_calculate_healthy_weight(args):
    return Bmi.calculate_healthy_weight(args.height[0])
Пример #15
0
def execute_calculate_weight_ranges_info(args):
    return Bmi.calculate_weight_ranges_with_info(args.height[0], args.lang)
Пример #16
0
def execute_calculate_weight(args):
    return Bmi.calculate_weight(args.height[0], args.bmi[0])
Пример #17
0
def execute_get_bmi_ranges_with_info(args):
    return Bmi.get_bmi_ranges_with_info(args.lang)
Пример #18
0
 def test_calculate_healthy_weight(self):
     self.assertEqual(Bmi.calculate_healthy_weight(1.80), [59.9, 81])
Пример #19
0
 def test_calculate_bmi_thin_59_176(self):
     self.assertEqual(Bmi.calculate_bmi(59, 1.76), 19,
                      "Body Mass Index for 59kg and 1.76m is 19")
Пример #20
0
 def test_get_bmi_range_info_under_lang(self):
     self.assertEqual(Bmi.get_bmi_range_info(17, "es"), "Bajo peso")
Пример #21
0
 def test_get_bmi_range_info_healthy(self):
     self.assertEqual(Bmi.get_bmi_range_info(19), "Healthy")
Пример #22
0
 def test_calculate_bmi_with_info(self):
     self.assertEqual(Bmi.calculate_bmi_with_info(80, 1.80),
                      (24.7, "Healthy"))
Пример #23
0
 def test_calculate_bmi_with_info_lang(self):
     self.assertEqual(Bmi.calculate_bmi_with_info(80, 1.80, "es"),
                      (24.7, "Peso saludable"))
Пример #24
0
 def test_calculate_bmi_equal_80_180(self):
     self.assertEqual(Bmi.calculate_bmi(80, 1.80), 24.7,
                      "Body Mass Index for 80kg and 1.80m is 24.7")
Пример #25
0
#Name: Naoimi Gillis
#Email: [email protected]
#Phone: 0857227932
#Attempt 2
from bmi import Bmi

bmi = Bmi()

print(bmi)

print(bmi._kgs)
print(bmi._cms)
bmi.print_bmi_imperial()
bmi.print_bmi_metric()
bmi.metric_bmi()
bmi.imperial_bmi()

bmi.set_metric_inputs(57, 164)
bmi.metric_bmi()

print(f"Kgs:{bmi.get_kgs()} Cms:{bmi.get_cms()}")