@@ -96,15 +96,20 @@ def test_get_task_inexistent(client):
9696
9797def test_cancel_tasks (client ):
9898 """Tests cancel a task with uid 1."""
99- task = client .cancel_tasks ({"uids" : ["1" ]})
99+ task = client .cancel_tasks ({"uids" : ["1" , "2" ]})
100100 tasks = client .get_tasks ({"types" : "taskCancelation" })
101101
102102 assert isinstance (task , TaskInfo )
103103 assert task .task_uid is not None
104104 assert task .index_uid is None
105- assert task .status == "enqueued" or "processing" or "succeeded"
105+ assert task .status in { "enqueued" , "processing" , "succeeded" }
106106 assert task .type == "taskCancelation"
107107 assert "uids" in tasks ["results" ][0 ]["details" ]["originalFilters" ]
108+ assert any (
109+ substring in tasks ["results" ][0 ]["details" ]["originalFilters" ]
110+ for substring in ["uids" , "1" , "2" ]
111+ )
112+
108113
109114def test_cancel_every_task (client ):
110115 """Tests cancel every task."""
@@ -114,8 +119,9 @@ def test_cancel_every_task(client):
114119 assert isinstance (task , TaskInfo )
115120 assert task .task_uid is not None
116121 assert task .index_uid is None
117- assert task .status == "enqueued" or "processing" or "succeeded"
122+ assert task .status in { "enqueued" , "processing" , "succeeded" }
118123 assert task .type == "taskCancelation"
119- assert "statuses" in tasks ["results" ][0 ]["details" ]["originalFilters" ]
120-
121-
124+ assert any (
125+ substring in tasks ["results" ][0 ]["details" ]["originalFilters" ]
126+ for substring in ["statuses" , "enqueued" , "processing" ]
127+ )
0 commit comments