MCPcopy Create free account
hub / github.com/pytest-dev/pytest / param

Function param

src/_pytest/mark/__init__.py:47–71  ·  view source on GitHub ↗

Specify a parameter in `pytest.mark.parametrize`_ calls or :ref:`parametrized fixtures `. .. code-block:: python @pytest.mark.parametrize( "test_input,expected", [ ("3+5", 8), pytest.param("6*9", 42,

(
    *values: object,
    marks: Union[MarkDecorator, Collection[Union[MarkDecorator, Mark]]] = (),
    id: Optional[str] = None,
)

Source from the content-addressed store, hash-verified

45
46
47def param(
48 *values: object,
49 marks: Union[MarkDecorator, Collection[Union[MarkDecorator, Mark]]] = (),
50 id: Optional[str] = None,
51) -> ParameterSet:
52 """Specify a parameter in `pytest.mark.parametrize`_ calls or
53 :ref:`parametrized fixtures <fixture-parametrize-marks>`.
54
55 .. code-block:: python
56
57 @pytest.mark.parametrize(
58 "test_input,expected",
59 [
60 ("3+5", 8),
61 pytest.param("6*9", 42, marks=pytest.mark.xfail),
62 ],
63 )
64 def test_eval(test_input, expected):
65 assert eval(test_input) == expected
66
67 :param values: Variable args of the values of the parameter set, in order.
68 :keyword marks: A single mark or a list of marks to be applied to this parameter set.
69 :keyword str id: The id to attribute to this parameter set.
70 """
71 return ParameterSet.param(*values, marks=marks, id=id)
72
73
74def pytest_addoption(parser: Parser) -> None:

Callers

nothing calls this directly

Calls 1

paramMethod · 0.80

Tested by

no test coverage detected