Skip to content

Instantly share code, notes, and snippets.

@mikeal
Created August 26, 2009 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikeal/175722 to your computer and use it in GitHub Desktop.
Save mikeal/175722 to your computer and use it in GitHub Desktop.
class TestsResult():
def __init__(self, tests):
self.numtestfiles = len(tests)
self.tests = tests
def smart_sum(x, y):
x['totalfails'] += y['fail']
x['totalpasses'] += y['pass']
x['totaltodos'] += y['todo']
totals = reduce(smart_sum, tests.values(), {"totalfails":0, "totalpasses":0, "totaltodos":0})
for key, value in totals.items():
setattr(self, key, value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment