Files
ai-workflow-course/modules/21-skills-teaching-the-ai-your-playbook/lab/start/test_tasks.py
T
claude 7f439212ac
Sync course wiki / sync-wiki (push) Successful in 5s
CI / check (push) Successful in 6s
Self-contained, skip-friendly lab starting points (#103)
Co-authored-by: claude <claude@jpaul.io>
Co-committed-by: claude <claude@jpaul.io>
2026-06-23 18:24:36 -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()