Skip to content

Commit

Permalink
Use dict comprehensions where obviously useful
Browse files Browse the repository at this point in the history
  • Loading branch information
bitprophet committed Oct 18, 2017
1 parent 1c937e3 commit 82dcc9e
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions tests/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ def returns_results_mapping(self):
g = SerialGroup.from_connections(cxns)
result = g.run("whatever", hide=True)
ok_(isinstance(result, GroupResult))
expected = {}
for cxn in cxns:
expected[cxn] = cxn.run.return_value
expected = {x: x.run.return_value for x in cxns}
eq_(result, expected)
eq_(result.succeeded, expected)
eq_(result.failed, {})
Expand Down Expand Up @@ -163,9 +161,7 @@ def queue_used_to_return_results(self, Queue):
# Execute & inspect results
g = ThreadingGroup.from_connections(cxns)
results = g.run(*self.args, **self.kwargs)
expected = {}
for cxn in cxns:
expected[cxn] = cxn.run.return_value
expected = {x: x.run.return_value for x in cxns}
eq_(results, expected)
# Make sure queue was used as expected within worker &
# ThreadingGroup.run()
Expand Down Expand Up @@ -213,9 +209,7 @@ def returns_results_mapping(self):
g = ThreadingGroup.from_connections(cxns)
result = g.run("whatever", hide=True)
ok_(isinstance(result, GroupResult))
expected = {}
for cxn in cxns:
expected[cxn] = cxn.run.return_value
expected = {x: x.run.return_value for x in cxns}
eq_(result, expected)
eq_(result.succeeded, expected)
eq_(result.failed, {})

0 comments on commit 82dcc9e

Please sign in to comment.