Last active
December 25, 2015 14:29
-
-
Save pfctdayelise/6990990 to your computer and use it in GitHub Desktop.
py.test examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pytest | |
@pytest.mark.parametrize("input", "expected", [ | |
("3+5", 8), | |
("2+4", 6), | |
]) | |
def test_evalPassing(input, expected): | |
assert eval(input) == expected | |
@pytest.mark.xfail | |
@pytest.mark.parametrize("input", "expected", [ | |
pytest.mark.xfail(("6*9", 42)), | |
]) | |
def test_evalXfail(input, expected): | |
assert eval(input) == expected |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pytest | |
@pytest.mark.parametrize("input", "expected", [ | |
("3+5", 8), | |
("2+4", 6), | |
pytest.mark.xfail(("6*9", 42)), | |
]) | |
def test_eval(input, expected): | |
assert eval(input) == expected |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment