
Product
Secure Your AI-Generated Code with Socket MCP
Socket MCP brings real-time security checks to AI-generated code, helping developers catch risky dependencies before they enter the codebase.
pytest-parametrized
Advanced tools
Supply Chain Security
Vulnerability
Quality
Maintenance
License
Pytest decorator for parametrizing tests with default iterables, providing alternative syntax for pytest.mark.parametrize.
Decorate tests with iterable default values. Other fixtures can still be used as normal.
from parametrized import parametrized
@parametrized
def test(..., name=values):
"""test single parametrized arg with each value"""
@parametrized.zip
def test(name=values, name1=values1, ...):
"""test parametrized args with zipped values"""
@parametrized.product
def test(name=values, name1=values1, ...):
"""test parametrized args with cartesian product of values"""
Zip before and after example:
@pytest.mark.parametrize("test_input,expected", [
("3+5", 8),
("2+4", 6),
("6*9", 42),
])
def test_eval(test_input, expected):
assert eval(test_input) == expected
@parametrized.zip
def test_eval(test_input=["3+5", "2+4", "6*9"], expected=[8, 6, 42]):
assert eval(test_input) == expected
Product before and after example:
@pytest.mark.parametrize("x", [0, 1])
@pytest.mark.parametrize("y", [2, 3])
def test_foo(x, y):
pass
@parametrized.product
def test_foo(x=[0, 1], y=[2, 3]):
pass
pytest.param
is supported for single values or .product
.
Parametrized fixtures which simply return their param.
fixture_name = parametrized.fixture(*params, **kwargs)
Before and after example:
@pytest.fixture(params=[0, 1], ids=["spam", "ham"])
def a(request):
return request.param
a = parametrized.fixture(0, 1, ids=["spam", "ham"])
% pip install pytest-parametrized
100% branch coverage.
% pytest [--cov]
FAQs
Pytest decorator for parametrizing tests with default iterables.
We found that pytest-parametrized demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket MCP brings real-time security checks to AI-generated code, helping developers catch risky dependencies before they enter the codebase.
Security News
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
Research
Security News
Socket’s Threat Research Team has uncovered 60 npm packages using post-install scripts to silently exfiltrate hostnames, IP addresses, DNS servers, and user directories to a Discord-controlled endpoint.