Test calc
In [ ]:
Copied!
import pytest
import pytest
In [ ]:
Copied!
from calc import add, divide, multiply, subtract
from calc import add, divide, multiply, subtract
In [ ]:
Copied!
def test_add():
assert add(2, 3) == 5
def test_add():
assert add(2, 3) == 5
In [ ]:
Copied!
def test_subtract():
assert subtract(5, 3) == 2
def test_subtract():
assert subtract(5, 3) == 2
In [ ]:
Copied!
def test_multiply():
assert multiply(4, 3) == 12
def test_multiply():
assert multiply(4, 3) == 12
In [ ]:
Copied!
def test_divide():
assert divide(6, 3) == 2
def test_divide():
assert divide(6, 3) == 2
In [ ]:
Copied!
def test_divide_by_zero():
with pytest.raises(ValueError):
divide(1, 0)
def test_divide_by_zero():
with pytest.raises(ValueError):
divide(1, 0)