Complete the code to define a test function using pytest.
def [1](): assert 1 + 1 == 2
Pytest requires test functions to start with test_. So test_addition is correct.
Complete the code to assert that a function returns the expected value.
def test_double(): result = double(3) assert result [1] 6
!= instead of ==.The assertion checks if result equals 6, so == is correct.
Fix the error in the test function name so pytest can discover it.
def [1](): assert sum([1, 2, 3]) == 6
Pytest discovers tests only if function names start with test_. test_sum is correct.
Fill both blanks to complete a test function that checks if a list contains a value.
def test_contains(): items = [1, 2, 3] assert [1] in [2]
The test checks if 2 is in the list items.
Fill all three blanks to create a test function that checks if a string starts with a prefix.
def test_startswith(): text = "hello world" prefix = "he" assert [1].[2]([3])
endswith instead of startswith.The test asserts that the string text starts with prefix using the startswith method.
