pytest material
This commit is contained in:
0
intro_pytest/tests/__init__.py
Normal file
0
intro_pytest/tests/__init__.py
Normal file
30
intro_pytest/tests/test_function.py
Normal file
30
intro_pytest/tests/test_function.py
Normal 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
|
Reference in New Issue
Block a user