Merge pull request #12 from zixuanzh/test-infrastructure

Basic Test infrastructure
This commit is contained in:
Robert Zajac
2018-10-21 14:30:48 -04:00
committed by GitHub
3 changed files with 18 additions and 0 deletions

1
tests/README.md Normal file
View File

@ -0,0 +1 @@
pytest gathers tests according to a naming convention. By default any file that is to contain tests must be named starting with test_ and any function in a file that should be treated as a test must also start with test_.

0
tests/__init.py__ Normal file
View File

17
tests/test_example.py Normal file
View File

@ -0,0 +1,17 @@
import pytest
@pytest.mark.parametrize("test_input,expected", [
("3+5", 8),
("2+4", 6),
("6*9", 42),
])
def test_eval(test_input, expected):
assert eval(test_input) == expected
@pytest.mark.parametrize("test_input,expected", [
("3+5", 8),
("2+4", 6),
("6*5", 30),
])
def test_eval2(test_input, expected):
assert eval(test_input) == expected