-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
46 lines (35 loc) · 1.96 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import unittest
from health_stats_calculator import *
class HealthStatsCalculatorTest(unittest.TestCase):
def test_calculate_bmi(self):
self.assertAlmostEqual(calculate_bmi(70, 1.75), 22.86, places=2)
self.assertAlmostEqual(calculate_bmi(80, 1.80), 24.69, places=2)
# Add more test cases for different inputs
def test_calculate_bmr(self):
self.assertAlmostEqual(calculate_bmr('M', 70, 175, 30), 1648.75, places=1)
self.assertAlmostEqual(calculate_bmr('F', 60, 160, 35), 1264.0, places=1)
# Add more test cases for different inputs
def test_calculate_max_heart_rate(self):
self.assertEqual(calculate_max_heart_rate(30), 190)
self.assertEqual(calculate_max_heart_rate(40), 180)
# Add more test cases for different inputs
def test_assess_resting_heart_rate(self):
self.assertEqual(assess_resting_heart_rate(70, 30), 'Normal')
self.assertEqual(assess_resting_heart_rate(85, 30), 'High')
# Add more test cases for different inputs
def test_get_expected_resting_heart_rate_range(self):
self.assertEqual(get_expected_resting_heart_rate_range(30), (60, 80))
self.assertEqual(get_expected_resting_heart_rate_range(40), (65, 85))
# Add more test cases for different inputs
def test_classify_hypertension(self):
self.assertEqual(classify_hypertension(130, 85), 'Stage 1 Hypertension')
# Add more test cases for different inputs
def test_calculate_max_aspartame_bottle(self):
self.assertEqual(calculate_max_aspartame_bottle(70, 250), 11)
# Add more test cases for different inputs
def test_calculate_body_fat_percentage(self):
self.assertAlmostEqual(calculate_body_fat_percentage('M', 70, 1.75, 30), 18.13, places=2)
self.assertAlmostEqual(calculate_body_fat_percentage('F', 60, 1.6, 35), 30.77, places=2)
# Add more test cases for different inputs
if __name__ == "__main__":
unittest.main()