MCPcopy
hub / github.com/celery/celery / test_group_to_chord

Method test_group_to_chord

t/unit/tasks/test_canvas.py:477–501  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

475 assert c.id == last_task.id
476
477 def test_group_to_chord(self):
478 c = (
479 self.add.s(5) |
480 group([self.add.s(i, i) for i in range(5)], app=self.app) |
481 self.add.s(10) |
482 self.add.s(20) |
483 self.add.s(30)
484 )
485 c._use_link = True
486 tasks, results = c.prepare_steps((), {}, c.tasks)
487
488 assert tasks[-1].args[0] == 5
489 assert isinstance(tasks[-2], chord)
490 assert len(tasks[-2].tasks) == 5
491
492 body = tasks[-2].body
493 assert len(body.tasks) == 3
494 assert body.tasks[0].args[0] == 10
495 assert body.tasks[1].args[0] == 20
496 assert body.tasks[2].args[0] == 30
497
498 c2 = self.add.s(2, 2) | group(self.add.s(i, i) for i in range(10))
499 c2._use_link = True
500 tasks2, _ = c2.prepare_steps((), {}, c2.tasks)
501 assert isinstance(tasks2[0], group)
502
503 def test_group_to_chord__protocol_2__or(self):
504 c = (

Callers

nothing calls this directly

Calls 3

groupClass · 0.90
prepare_stepsMethod · 0.80
sMethod · 0.45

Tested by

no test coverage detected