Complete the code to import pytest for writing tests.
import [1]
We use pytest to write and run tests in Python.
Complete the code to define a simple integration test function.
def test_components_work_together(): result = component_a() [1] component_b() assert result == 'success'
We combine outputs from component_a() and component_b() using + to simulate integration.
Fix the error in the assertion to correctly check the integration result.
def test_integration(): output = integrate_components() assert output [1] 'expected output'
The assertion should check if output equals the expected string using ==.
Fill both blanks to create a dictionary comprehension that maps component names to their test results if the result is successful.
results = {name: result for name, result in components.items() if result [1] 'success' and name [2] 'component_x'}The comprehension keeps items where result == 'success' and name != 'component_x'.
Fill all three blanks to create a test that asserts all components return 'ok' status.
def test_all_components_ok(): statuses = {name: status for name, status in check_statuses().items() if status [1] 'ok'} assert all(status [2] 'ok' for status in statuses.values()) [3] True
The comprehension filters statuses equal to 'ok', the assertion checks all statuses equal 'ok', and is True confirms the boolean result.