Пример #1
0
    def add_log(self):
        c.execute("""CREATE TABLE IF NOT EXISTS Health(
               Log_date text,
               First_NAME text,
               Last_NAME text,
               weight REAL,
               calories_in REAl,
               calories_out REAl,
               bmi REAL
        )""")
        user = h.Health(self.f_name.get(), self.l_name.get(),
                        int(self.age.get()), float(self.weight.get()),
                        int(self.height_ft.get()), int(self.height_in.get()),
                        int(self.calories_out.get()),
                        int(self.calories_in.get()))
        db.insert_log(user)
        db.conn.commit()

        self.add_log_button.configure(state=tkinter.DISABLED)
        self.view_average.configure(state=tkinter.NORMAL)
Пример #2
0
 def setUp(self):
     self.test_user = h.Health("Mike", "Moore", 20, 190.5, 5, 10, 2000, 100)
Пример #3
0
 def test_invalid_Calorie_Out_alpha(self):
     with self.assertRaises(ValueError):
         testuser = h.Health("Mike", "Moore", 20, 190.5, 5, 10, 2000,
                             'dw32')
Пример #4
0
 def test_invalid_weight_BMI(self):
     with self.assertRaises(ValueError):
         testuser = h.Health("Mike", "Moore", 20, 4590.5, 100, 10, 2000,
                             100)
Пример #5
0
 def test_invalid_Calorie_Intake_alpha(self):
     with self.assertRaises(ValueError):
         testuser = h.Health("Mike", "Moore", 20, 190.5, 5, 10, '20f0', 100)