MCPcopy
hub / github.com/pytest-dev/pytest / _parse_parametrize_args

Method _parse_parametrize_args

src/_pytest/mark/structures.py:166–181  ·  src/_pytest/mark/structures.py::ParameterSet._parse_parametrize_args
(
        argnames: str | Sequence[str],
        argvalues: Iterable[ParameterSet | Sequence[object] | object],
        *args,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

164
165 @staticmethod
166 def _parse_parametrize_args(
167 argnames: str | Sequence[str],
168 argvalues: Iterable[ParameterSet | Sequence[object] | object],
169 *args,
170 **kwargs,
171 ) -> tuple[Sequence[str], bool]:
172 if isinstance(argnames, str):
173 class="cm"># A trailing comma indicates tuple-style: class="st">"arg," is equivalent to (class="st">"arg",)
174 class="cm"># In this case, argvalues should be a list of tuples, not wrapped values.
175 class="cm"># See https://github.com/pytest-dev/pytest/issues/719
176 has_trailing_comma = argnames.rstrip().endswith(class="st">",")
177 argnames = [x.strip() for x in argnames.split(class="st">",") if x.strip()]
178 force_tuple = len(argnames) == 1 and not has_trailing_comma
179 else:
180 force_tuple = False
181 return argnames, force_tuple
182
183 @staticmethod
184 def _parse_parametrize_parameters(

Callers 3

_for_parametrizeMethod · 0.80

Calls 2

endswithMethod · 0.80
stripMethod · 0.80

Tested by

no test coverage detected