import math
# a more general form of the function
def sector_area(radius1, radius2, angle_deg):
angle_rad = (2 * math.pi / 360) * angle_deg # changing degrees to radians
area = 0.5 * (radius1**2 - radius2**2) * angle_rad
return area
def test_gt0():
for rad1, rad2, ang in [(2, 1, 30), (10, 5, 270)]:
assert sector_area(rad1, rad2, ang) > 0
def test_angle0():
assert sector_area(5, 1, 0) == 0
def test_full():
assert sector_area(5, 0, 360) == math.pi * 25
test_gt0()
test_angle0()
test_full()