Skip to content

Commit 5fe5acf

Browse files
pytest.param: update docs from marked
1 parent 9033dd7 commit 5fe5acf

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

doc/en/parametrize.rst

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ them in turn::
5858
platform linux -- Python 3.5.2, pytest-3.0.3, py-1.4.31, pluggy-0.4.0
5959
rootdir: $REGENDOC_TMPDIR, inifile:
6060
collected 3 items
61-
61+
6262
test_expectation.py ..F
63-
63+
6464
======= FAILURES ========
6565
_______ test_eval[6*9-42] ________
66-
66+
6767
test_input = '6*9', expected = 42
68-
68+
6969
@pytest.mark.parametrize("test_input,expected", [
7070
("3+5", 8),
7171
("2+4", 6),
@@ -75,7 +75,7 @@ them in turn::
7575
> assert eval(test_input) == expected
7676
E assert 54 == 42
7777
E + where 54 = eval('6*9')
78-
78+
7979
test_expectation.py:8: AssertionError
8080
======= 1 failed, 2 passed in 0.12 seconds ========
8181

@@ -94,7 +94,8 @@ for example with the builtin ``mark.xfail``::
9494
@pytest.mark.parametrize("test_input,expected", [
9595
("3+5", 8),
9696
("2+4", 6),
97-
pytest.mark.xfail(("6*9", 42)),
97+
pytest.param("6*9", 42,
98+
marks=pytest.mark.xfail),
9899
])
99100
def test_eval(test_input, expected):
100101
assert eval(test_input) == expected
@@ -119,11 +120,11 @@ Let's run this::
119120
$ pytest
120121
======= test session starts ========
121122
platform linux -- Python 3.5.2, pytest-3.0.3, py-1.4.31, pluggy-0.4.0
122-
rootdir: $REGENDOC_TMPDIR, inifile:
123+
rootdir: $REGENDOC_TMPDIR, inifile:
123124
collected 3 items
124-
125+
125126
test_expectation.py ..x
126-
127+
127128
======= 2 passed, 1 xfailed in 0.12 seconds ========
128129

129130
The one parameter set which caused a failure previously now
@@ -196,15 +197,15 @@ Let's also run with a stringinput that will lead to a failing test::
196197
F
197198
======= FAILURES ========
198199
_______ test_valid_string[!] ________
199-
200+
200201
stringinput = '!'
201-
202+
202203
def test_valid_string(stringinput):
203204
> assert stringinput.isalpha()
204205
E assert False
205206
E + where False = <built-in method isalpha of str object at 0xdeadbeef>()
206207
E + where <built-in method isalpha of str object at 0xdeadbeef> = '!'.isalpha
207-
208+
208209
test_strings.py:3: AssertionError
209210
1 failed in 0.12 seconds
210211

0 commit comments

Comments
 (0)