Project 27: To-Do List UI
Python Challenge
Builds on these lessons
Step 1 of 3
Project
A pytest Fixture for Sample Tasks
Write @pytest.fixture def sample_tasks(): returning a fresh task list, and accept it as an argument in a test function. A fixture builds the exact same test data fresh for every test that needs it — no test can accidentally see another test's leftover mutations.
🎯 Your Task
Please add the exact code shown in the light gray box below to your editor.Do not delete your previous code, just insert these new lines in the correct place!
import pytest
@pytest.fixture
def sample_tasks():
return [{"title": "Draft report", "done": False}]
def test_new_list_has_one_task(sample_tasks):
assert len(sample_tasks) == 1