Files
ai-workflow-course/modules/21-skills-teaching-the-ai-your-playbook/lab/start/test_tasks.py
T
claude 07182429c4
CI / check (pull_request) Successful in 7s
feat(labs): make every lab a self-contained, skip-friendly starting point
Each lab now stands on its own; no hard dependency on prior labs.
- App-based labs get a canonical tasks-app snapshot in lab/start/ (three
  baselines: v0 add/list/done; v1 +count; v2 +count/delete), assigned by where
  each module sits in the command timeline. Modules with a purpose-built app
  (M10 trap, M13 planted bug, M21) snapshot their own app; planted devices kept.
- Self-contained labs (M15/17/18/19/22/23/24/25/27, which operate on their own
  lab files) get a preamble pointing at modules/NN/lab/.
- Every module + capstone gets a "Starting point (skip-friendly)" preamble:
  copy the snapshot, git init -b main, commit -> clean status, then start.

Lets a learner skip around or recover: copy start/, commit, go. All snapshots
run; tools/check.sh passes; no em-dashes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TfzV5QvtPDz8LJS3Pu5VLT
2026-06-23 18:24:17 -04:00

45 lines
1.1 KiB
Python

"""Test suite for the tasks-app. Run from this folder with:
python -m unittest
Your "add a command" skill should ADD a test here for every new command. The point is to assert
intended behavior, not just that nothing crashed.
"""
import unittest
from tasks import TaskList
class TestTaskBasics(unittest.TestCase):
def test_add_appends_a_task(self):
tl = TaskList()
tl.add("write the skill")
self.assertEqual(len(tl.tasks), 1)
self.assertEqual(tl.tasks[0].title, "write the skill")
self.assertFalse(tl.tasks[0].done)
def test_complete_marks_done(self):
tl = TaskList()
tl.add("a")
tl.complete(0)
self.assertTrue(tl.tasks[0].done)
def test_pending_excludes_completed(self):
tl = TaskList()
tl.add("a")
tl.add("b")
tl.complete(0)
self.assertEqual([t.title for t in tl.pending()], ["b"])
def test_pending_count_ignores_done(self):
tl = TaskList()
tl.add("a")
tl.add("b")
tl.complete(0)
self.assertEqual(tl.pending_count(), 1)
if __name__ == "__main__":
unittest.main()