first commit
CI / test (push) Successful in 44s

This commit is contained in:
2026-05-31 13:27:47 +02:00
commit 4ee1c810c1
6 changed files with 404 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
import pytest
from calculator import add, subtract, multiply, divide
def test_add():
assert add(2, 3) == 5
assert add(-1, 1) == 0
assert add(0, 0) == 0
def test_subtract():
assert subtract(10, 4) == 6
assert subtract(0, 5) == -5
def test_multiply():
assert multiply(3, 4) == 12
assert multiply(-2, 5) == -10
assert multiply(0, 100) == 0
def test_divide():
assert divide(10, 2) == 5
assert divide(7, 2) == 3.5
def test_divide_by_zero():
with pytest.raises(ValueError, match="Cannot divide by zero"):
divide(5, 0)