Skip to content

Commit 515a5c2

Browse files
committed
fixes @task_unique function arg - see #761
1 parent 260df34 commit 515a5c2

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

custom_components/pyscript/eval.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ async def trigger_init(self, trig_ctx, func_name):
382382
"state_active": {"arg_cnt": {1}},
383383
"state_trigger": {"arg_cnt": {"*"}, "type": {list, set}, "rep_ok": True},
384384
"service": {"arg_cnt": {0, "*"}},
385-
"task_unique": {"arg_cnt": {1, 2}},
385+
"task_unique": {"arg_cnt": {1}},
386386
"time_active": {"arg_cnt": {"*"}},
387387
"time_trigger": {"arg_cnt": {0, "*"}, "rep_ok": True},
388388
"webhook_trigger": {"arg_cnt": {1, 2}, "rep_ok": True},

tests/test_unique.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ async def test_task_unique(hass, caplog):
7878
seq_num = 0
7979
8080
@time_trigger("startup")
81+
@task_unique("func6")
8182
def funcStartupSync():
8283
global seq_num, funcStartupSync_id
8384
@@ -88,9 +89,11 @@ def funcStartupSync():
8889
#
8990
# stick around so the task.unique() still applies
9091
#
91-
task.unique("func6")
9292
assert task.current_task() == task.name2id("func6")
9393
assert task.current_task() == task.name2id()["func6"]
94+
task.unique("func7")
95+
assert task.current_task() == task.name2id("func7")
96+
assert task.current_task() == task.name2id()["func7"]
9497
task.sleep(10000)
9598
9699
@service

0 commit comments

Comments
 (0)