Skip to content

Commit 5450e9d

Browse files
committed
Added tests.
1 parent d156aad commit 5450e9d

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

tests/abc/test_broker.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from collections.abc import AsyncGenerator
2+
from copy import copy
23

34
from taskiq.abc.broker import AsyncBroker
45
from taskiq.decor import AsyncTaskiqDecoratedTask
@@ -61,3 +62,17 @@ async def test_func() -> None:
6162
"label1": 1,
6263
"label2": 2,
6364
}
65+
66+
67+
def test_kicker_labels_modification() -> None:
68+
"""Test that using kicker.with_labels doesn't modify task's labels globally."""
69+
broker = _TestBroker()
70+
71+
@broker.task(test_lb="one")
72+
async def test_task() -> None: ...
73+
74+
old_labels = copy(test_task.labels)
75+
test_kicker = test_task.kicker().with_labels(another_label="test")
76+
assert "another_label" in test_kicker.labels
77+
78+
assert test_task.labels == old_labels

0 commit comments

Comments
 (0)