blob: e4e2cda6d6f8467f2b954fd775caa2d947040e7a (
plain)
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
|
from todolist import TodoEntry, TodoList, get_default_list, set_default_list
todo = TodoList()
entry = TodoEntry(text="Write bindings for strings in records")
todo.add_item("Write python bindings")
assert todo.get_last() == "Write python bindings"
todo.add_item("Write tests for bindings")
assert todo.get_last() == "Write tests for bindings"
todo.add_entry(entry)
assert todo.get_last() == "Write bindings for strings in records"
assert todo.get_last_entry().text == "Write bindings for strings in records"
todo.add_item(
"Test Ünicode hàndling without an entry can't believe I didn't test this at first 🤣"
)
assert (
todo.get_last()
== "Test Ünicode hàndling without an entry can't believe I didn't test this at first 🤣"
)
entry2 = TodoEntry(
text="Test Ünicode hàndling in an entry can't believe I didn't test this at first 🤣"
)
todo.add_entry(entry2)
assert (
todo.get_last_entry().text
== "Test Ünicode hàndling in an entry can't believe I didn't test this at first 🤣"
)
todo2 = TodoList()
assert todo != todo2
assert todo is not todo2
assert get_default_list() is None
set_default_list(todo)
assert todo.get_items() == get_default_list().get_items()
todo2.make_default()
assert todo2.get_items() == get_default_list().get_items()
todo.add_item("Test liveness after being demoted from default")
assert todo.get_last() == "Test liveness after being demoted from default"
todo2.add_item("Test shared state through local vs default reference")
assert (
get_default_list().get_last()
== "Test shared state through local vs default reference"
)
|