-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_app.py
More file actions
57 lines (43 loc) · 1.23 KB
/
test_app.py
File metadata and controls
57 lines (43 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
"""
Unit tests for Todo List Application
"""
import pytest
from app import TodoList
def test_add_todo():
"""Test adding a todo item"""
todo = TodoList()
todo.add_todo("Learn Git")
assert len(todo.todos) == 1
assert todo.todos[0]["task"] == "Learn Git"
assert todo.todos[0]["completed"] is False
def test_complete_todo():
"""Test completing a todo item"""
todo = TodoList()
todo.add_todo("Master GitHub")
todo.complete_todo(0)
assert todo.todos[0]["completed"] is True
def test_delete_todo():
"""Test deleting a todo item"""
todo = TodoList()
todo.add_todo("Practice rebase")
todo.delete_todo(0)
assert len(todo.todos) == 0
def test_list_empty_todos():
"""Test listing when no todos exist"""
todo = TodoList()
todo.list_todos()
assert len(todo.todos) == 0
def test_invalid_complete_index():
"""Test completing with invalid index"""
todo = TodoList()
todo.add_todo("Test error handling")
todo.complete_todo(999) # Should not crash
assert todo.todos[0]["completed"] is False
# TODO: Add more tests
# TODO: Test file operations
def test_placeholder():
pass
# TODO: Add more tests
# TODO: Test file operations
def test_placeholder():
pass