Add CircleArea with failing test

This commit is contained in:
venomade committed 2026-11-16 10:40:36 +00:00
1 parent bf6cdbd999
commit b6549523a1
2 files changed
+10 -1

No files matched your search

+6
View File
@@ -12,6 +12,12 @@ def multiply(a, b):
def divide(a, b): def divide(a, b):
return a / b return a / b
def CircleArea(r):
if r >= 0:
return 3.14 * r * r
else:
return "NaN"
def main(): def main():
while True: while True:
a = float(input("First number: ")) a = float(input("First number: "))
+4 -1
View File
@@ -1,4 +1,4 @@
from calculator import add, subtract, multiply, divide from calculator import add, subtract, multiply, divide, CircleArea
def test_add(): def test_add():
assert add(2, 3) == 5 assert add(2, 3) == 5
@@ -19,3 +19,6 @@ def test_divide_uneven():
result = divide(a, b) result = divide(a, b)
# Assert # Assert
assert result == 2.5 assert result == 2.5
def test_circleArea():
assert CircleArea(-4) == "Error"