Example #1
0
File: app.py Project: wmf76/working
def getbmi():
    if request.method == 'POST':
        if request.form['submit'] == 'submit':
            height = float(request.form['height'])
            weight = float(request.form['weight'])
            cat, out = bmi(weight, height)
            return render_template('bmi.html', category=cat, message=out)
    return render_template('bmi.html')
    #bmi page go here
    print('bmi')
Example #2
0
 def test_underweight(self):
     cat, out, wflag, hflag = bmi(120, 72)
     self.assertEqual(cat, 'Underweight')
Example #3
0
 def test_inputheight(self):
     cat, out, wflag, hflag = bmi(300, 80)
     self.assertIs(hflag, True)
Example #4
0
 def test_inputweight(self):
     cat, out, wflag, hflag = bmi(300, 68)
     self.assertIs(wflag, True)
Example #5
0
 def test_overweight(self):
     cat, out, wflag, hflag = bmi(215, 73)
     self.assertEqual(cat, 'Overweight')
Example #6
0
 def test_obese(self):
     cat, out, wflag, hflag = bmi(300, 72)
     self.assertEqual(cat, 'Obese')
Example #7
0
 def test_normal(self):
     cat, out, wflag, hflag = bmi(180, 72)
     self.assertEqual(cat, 'Normal')