diff --git a/tests/test_param.py b/tests/test_param.py index b0f2438b..bb70c176 100644 --- a/tests/test_param.py +++ b/tests/test_param.py @@ -69,4 +69,35 @@ class TestDynamic: scenarios = scenarios def test_sum_positive(self, x, y): - assert (x + y) >= 0 \ No newline at end of file + assert (x + y) >= 0 + + +def pytest_generate_tests(metafunc): + if "val" in metafunc.fixturenames: + metafunc.parametrize("val", [10, 20, 30], ids=["ten", "twenty", "thirty"]) + +def test_dynamic(val): + assert val % 10 == 0 + +import pytest + +@pytest.fixture(params=["fire", "water", "earth"], ids=["🔥", "💧", "🌍"]) +def element(request): + return request.param + +def test_element_type(element): + assert isinstance(element, str) + +@pytest.mark.parametrize("x", [1, 2]) +@pytest.mark.parametrize("y", ["a", "b"]) +def test_combination(x, y): + assert isinstance(y, str) + +@pytest.fixture +def complex_setup(request): + val = request.param + return val * 2 + +@pytest.mark.parametrize("complex_setup", [1, 2], indirect=True) +def test_indirect_fixture(complex_setup): + assert complex_setup in [2, 4] \ No newline at end of file