Complete the code to create a test case that checks if a function returns the expected result.
def test_addition(): result = add(2, 3) assert result [1] 5
The assertion must check if the result is equal to 5 using '=='.
Complete the code to skip a test when a condition is met.
import pytest @pytest.mark.skipif([1], reason="Not supported") def test_feature(): assert feature() == True
The test is skipped when the condition is True, so use True.
Fix the error in the assertion to properly check if a list contains an item.
def test_contains(): items = ['apple', 'banana', 'cherry'] assert [1] in items
The item to check must be a string literal in quotes, so use 'banana'.
Fill both blanks to create a dictionary comprehension that maps words to their lengths only if length is greater than 3.
lengths = {word: [1] for word in words if len(word) [2] 3}The dictionary maps each word to its length, so use len(word). The condition filters words longer than 3, so use >.
Fill all three blanks to create a filtered dictionary with uppercase keys and values greater than 0.
result = [1]: [2] for [3], v in data.items() if v > 0}
Keys are converted to uppercase with k.upper(), values remain v, and the loop variable for keys is k.