Skip to content

Commit 7ac5c18

Browse files
committed
mark: add docstring for ParameterSet
This is not an exported type, adding a doc mostly so I can quickly remember what it is when reading code.
1 parent dbec145 commit 7ac5c18

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/_pytest/mark/structures.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,33 @@ def get_empty_parameterset_mark(
7878

7979

8080
class ParameterSet(NamedTuple):
81+
"""A set of values for a set of parameters along with associated marks and
82+
an optional ID for the set.
83+
84+
Examples::
85+
86+
pytest.param(1, 2, 3)
87+
# ParameterSet(values=(1, 2, 3), marks=(), id=None)
88+
89+
pytest.param("hello", id="greeting")
90+
# ParameterSet(values=("hello",), marks=(), id="greeting")
91+
92+
# Parameter set with marks
93+
pytest.param(42, marks=pytest.mark.xfail)
94+
# ParameterSet(values=(42,), marks=(MarkDecorator(...),), id=None)
95+
96+
# From parametrize mark (parameter names + list of parameter sets)
97+
pytest.mark.parametrize(
98+
("a", "b", "expected"),
99+
[
100+
(1, 2, 3),
101+
pytest.param(40, 2, 42, id="everything"),
102+
],
103+
)
104+
# ParameterSet(values=(1, 2, 3), marks=(), id=None)
105+
# ParameterSet(values=(2, 2, 3), marks=(), id="everything")
106+
"""
107+
81108
values: Sequence[object | NotSetType]
82109
marks: Collection[MarkDecorator | Mark]
83110
id: str | _HiddenParam | None

0 commit comments

Comments
 (0)