-
-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathtest_state.py
58 lines (33 loc) · 1.04 KB
/
test_state.py
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
58
from taskiq.state import TaskiqState
def test_state_set() -> None:
"""Tests that you can sel values as dict items."""
state = TaskiqState()
state["a"] = 1
assert state["a"] == 1
def test_state_get() -> None:
"""Tests that you can get values as dict items."""
state = TaskiqState()
state["a"] = 1
assert state["a"] == 1
def test_state_del() -> None:
"""Tests that you can del values as dict items."""
state = TaskiqState()
state["a"] = 1
del state["a"]
assert state.get("a") is None
def test_state_set_attr() -> None:
"""Tests that you can set values by attribute."""
state = TaskiqState()
state.a = 1
assert state["a"] == 1
def test_state_get_attr() -> None:
"""Tests that you can get values by attribute."""
state = TaskiqState()
state["a"] = 1
assert state.a == 1
def test_state_del_attr() -> None:
"""Tests that you can delete values by attribute."""
state = TaskiqState()
state["a"] = 1
del state.a
assert state.get("a") is None