Skip to content

Commit

Permalink
Replaced group_n with all.
Browse files Browse the repository at this point in the history
  • Loading branch information
severb committed Nov 13, 2014
1 parent 7513ac3 commit e50fe27
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 3 additions & 4 deletions flowy/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,11 @@ def first_n(self, n, result, *results):
i = _i_or_args(result, results)
if n == 1:
return self.first(i)
return sorted(i)[:n]
return self.all(i)[:n]

def group_n(self, n, result, *results):
def all(self, result, *results):
i = _i_or_args(result, results)
ii = iter(sorted(i))
return izip(*[ii] * n)
return sorted(i)

def restart(self, *args, **kwargs):
try:
Expand Down
6 changes: 3 additions & 3 deletions flowy/tests/test_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ def test_first_n(self):
)


class TestGroupResults(TestWorkflowBase):
class TestAllResults(TestWorkflowBase):
def make_workflow(self):
from flowy.task import _SWFWorkflow
from flowy.proxy import SWFActivityProxy
Expand All @@ -558,7 +558,7 @@ def run(self):
r = []
for _ in range(7):
r.append(self.x())
return [[x.result() for x in y] for y in self.group_n(2, r)]
return [x.result() for x in self.all(r)]

return MyWorkflow

Expand All @@ -567,5 +567,5 @@ def test_group_n(self):
order = list(reversed(range(7)))
self.set_state(results=results, order=order)
self.assert_scheduled(
('COMPLETE', '[[7, 6], [5, 4], [3, 2]]')
('COMPLETE', '[7, 6, 5, 4, 3, 2, 1]')
)

0 comments on commit e50fe27

Please sign in to comment.