[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2021-10-31 13:25:30 +00:00
parent cdcb78f9fe
commit f74f6a87a3
3 changed files with 17 additions and 14 deletions

View File

@ -14,4 +14,4 @@ For example, now such a construction is possible::
)
Earlier in this case the values ``a, b, c`` in test are a ``ParameterSet`` objects
Earlier in this case the values ``a, b, c`` in test are a ``ParameterSet`` objects

View File

@ -1140,7 +1140,9 @@ class Metafunc:
normalized_values.append(*param_value.values)
if param_value.marks:
merged_marks.append(*param_value.marks)
param_set = ParameterSet(values=tuple(normalized_values), marks=merged_marks, id=None)
param_set = ParameterSet(
values=tuple(normalized_values), marks=merged_marks, id=None
)
newcallspec = callspec.setmulti(
valtypes=arg_values_types,
argnames=argnames,
@ -1404,8 +1406,10 @@ def _idvalset(
if val.id:
this_id.append(val.id)
continue
to_get_idval = (val.values[0] if len(val.values) == 1 else val.values)
this_id.append(_idval(to_get_idval, argname, idx, idfn, nodeid=nodeid, config=config))
to_get_idval = val.values[0] if len(val.values) == 1 else val.values
this_id.append(
_idval(to_get_idval, argname, idx, idfn, nodeid=nodeid, config=config)
)
return "-".join(this_id)
else:
return _ascii_escaped_by_config(id, config)

View File

@ -1,7 +1,10 @@
import os
import sys
from typing import List, NamedTuple, Tuple, Any
from typing import Any
from typing import List
from typing import NamedTuple
from typing import Optional
from typing import Tuple
from unittest import mock
import pytest
@ -355,14 +358,10 @@ def test_parametrize_with_nested_paramsets(
pytester: Pytester, pytester_internal_test_values: List[Any]
) -> None:
"""Test parametrize with nested pytest.param objects in value"""
case = NamedTuple(
"case",
[
("expected_test_id", str),
("expected_value", Tuple[Any, ...]),
("expected_marks", Tuple[str, ...]),
],
)
class case(NamedTuple):
expected_test_id: str
expected_value: Tuple[Any, ...]
expected_marks: Tuple[str, ...]
cases = (
case("1-nested_2-3", (1, 2, 3), ("parametrize",)),
case("one_two_three", (1, 2, 3), ("parametrize",)),
@ -383,7 +382,7 @@ def test_parametrize_with_nested_paramsets(
"""
import pytest
@pytest.mark.parametrize(
"a, b, c",
"a, b, c",
[
(1, pytest.param(2, id="nested_2"), pytest.param(3)),
pytest.param(1, pytest.param(2, id="nested_2"), pytest.param(3), id="one_two_three"),