Skip to content

Instantly share code, notes, and snippets.

@pfctdayelise
Last active December 25, 2015 14:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pfctdayelise/6990990 to your computer and use it in GitHub Desktop.
Save pfctdayelise/6990990 to your computer and use it in GitHub Desktop.
py.test examples
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
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