Skip to content

Instantly share code, notes, and snippets.

@jangia
Created March 18, 2024 17:26
Show Gist options
  • Save jangia/b5b80026828fbabb5647a16efde35343 to your computer and use it in GitHub Desktop.
Save jangia/b5b80026828fbabb5647a16efde35343 to your computer and use it in GitHub Desktop.
Testing behavior, not implementation details – In-Memory Store Tests
# behavior/tests.py
def test_add_task_():
store = TaskStoreInMemory()
task = Task(title="Do the dishes", status=TaskStatus.OPEN)
store.add_task(task)
assert store.tasks[0].title == "Do the dishes"
assert store.tasks[0].status == "OPEN"
def test_list_tasks_():
store = TaskStoreInMemory()
task = Task(title="Do the dishes", status=TaskStatus.OPEN)
store.tasks.append(task)
assert store.list_tasks() == [task]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment