Commit 5ffa6b7d authored by Mathieu Giraud's avatar Mathieu Giraud

src/should.py: Stats.str_status(), order according to STATUS_ORDER

parent 193e2f12
Pipeline #612 passed with stages
in 12 seconds
......@@ -403,6 +403,12 @@ class Stats():
def items(self):
return self.stats.items()
def __iter__(self):
'''Ordered according to STATUS_ORDER'''
for key in STATUS_ORDER[::-1]:
if key in self.keys():
yield (key, self[key])
def values(self):
return self.stats.values()
......@@ -421,7 +427,7 @@ class Stats():
s += STATUS[status]
s += ' - '
s = color(STATUS_COLORS[status], s, colorize)
s += ' '.join([color(STATUS_COLORS[key], '%s:%d', colorize) % (STATUS[key], len(val)) for (key, val) in self.items()])
s += ' '.join([color(STATUS_COLORS[key], '%s:%d', colorize) % (STATUS[key], len(val)) for (key, val) in self])
nb_items = '- total:%s' % self.total()
if self.item:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment