Complete the code to define a simple data provider function that returns test data.
def data_provider(): return [1]
The data provider should return a list of tuples, each tuple representing a set of test data.
Complete the test function to use the data provider with pytest's parametrize decorator.
@pytest.mark.parametrize('username, password', [1]) def test_login(username, password): assert username != '' and password != ''
The parametrize decorator expects the function name without parentheses to use it as a data provider.
Fix the error in the data provider function that causes a syntax error.
def data_provider(): return [ ('user1', 'pass1'), ('user2', 'pass2')[1] ]
In Python lists, items are separated by commas. Missing a comma causes a syntax error.
Fill both blanks to create a dictionary comprehension that maps usernames to passwords from the data provider list.
credentials = [1] for user, pwd in data_provider() if user [2] 'user1'
The dictionary comprehension should map user to password, and filter where user equals 'user1'.
Fill all three blanks to create a test function that uses the data provider and asserts the password length is at least 5.
@pytest.mark.parametrize('[1]', [2]) def test_password_length([3]): assert len(password) >= 5
The parametrize decorator needs the parameter names as a string, the data provider function call, and the test function parameters without quotes.