pytest material

This commit is contained in:
2021-09-19 11:13:03 +12:00
parent 45f7d5b759
commit 07cd9bea86
8 changed files with 286 additions and 2 deletions

View File

View File

@@ -0,0 +1,30 @@
# test_function.py
import pytest
from function import Maths
@pytest.fixture
def maths():
return Maths(10)
def test_exists(maths):
"""
Checks if objects are created
"""
assert isinstance(maths, Maths)
def test_add(maths):
"""
Addition method
"""
assert maths.add(10) == 20
def test_subtract(maths):
"""
Subtraction method
"""
assert maths.subtract(5) == 5