Complete the code to create a parametrized fixture with pytest.
import pytest @pytest.fixture(params=[1, 2, 3]) def number(request): return request.[1]
request.params instead of request.param.request.value which does not exist.The request.param attribute gives the current parameter value in a parametrized fixture.
Complete the test function to receive the parametrized fixture value.
def test_is_positive([1]): assert [1] > 0
param or request as parameter names instead of the fixture name.The test function must accept the fixture name as a parameter to receive its value.
Fix the error in the fixture to correctly parametrize it with strings.
import pytest @pytest.fixture(params=[1]) def greeting(request): return request.param
The params argument must be a list or tuple of values. A list literal with quotes is correct.
Fill both blanks to parametrize a fixture with numbers and use it in a test.
import pytest @pytest.fixture(params=[1]) def num(request): return request.param def test_even([2]): assert [2] % 2 == 0
The fixture is parametrized with even numbers in a list. The test function must accept the fixture name num to get the values.
Fill all three blanks to create a parametrized fixture with mixed types and test their types.
import pytest @pytest.fixture(params=[1]) def data(request): return request.param def test_type([2]): assert isinstance([3], (int, str))
The fixture is parametrized with a list containing integers and a string. The test function receives the fixture data and checks if its type is int or str.