Complete the code to use the fixture as a function argument.
import pytest @pytest.fixture def sample_data(): return [1, 2, 3] def test_sum([1]): assert sum(sample_data) == 6
The fixture name sample_data must be used as the test function argument to access its value.
Complete the test function argument to receive the fixture value.
import pytest @pytest.fixture def user_info(): return {'name': 'Alice', 'age': 30} def test_user_age([1]): assert user_info['age'] == 30
The test function must accept the fixture user_info as an argument to use its returned data.
Fix the error in the test function argument to correctly use the fixture.
import pytest @pytest.fixture def numbers(): return [10, 20, 30] def test_max([1]): assert max(numbers) == 30
The test function argument must be named exactly as the fixture numbers to receive its value.
Fill both blanks to correctly use two fixtures as function arguments.
import pytest @pytest.fixture def first_name(): return 'John' @pytest.fixture def last_name(): return 'Doe' def test_full_name([1], [2]): full_name = first_name + ' ' + last_name assert full_name == 'John Doe'
Both fixtures first_name and last_name must be passed as arguments to the test function to use their values.
Fill all three blanks to correctly use fixtures and assert the combined result.
import pytest @pytest.fixture def city(): return 'Paris' @pytest.fixture def country(): return 'France' def test_location([1], [2]): location = city + ', ' + country assert location == 'Paris, France'
The test function must accept the fixtures city and country as arguments, and location is the variable holding the combined string.