def test_value_not_in_range(self): with self.assertRaises(Exception): percent.validate_percent(500) with self.assertRaises(Exception): percent.validate_percent(-10)
def test_value_in_range(self): result = percent.validate_percent(50) self.assertEqual(result, 50)
def test_upper_boundary(self): result = percent.validate_percent(100) self.assertEqual(result, 100)
def test_lower_boundary(self): result = percent.validate_percent(0) self.assertEqual(result, 0)
def test_above_upper_boundary(self): with self.assertRaises(Exception): percent.validate_percent(101)
def test_below_lower_boundary(self): with self.assertRaises(Exception): percent.validate_percent(-1)