Skip to content

Commit

Permalink
Add test for issue #41
Browse files Browse the repository at this point in the history
  • Loading branch information
avylove committed Feb 13, 2021
1 parent 42cf5b6 commit 1ef3f89
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test_counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,22 @@ def test_subcounter_count_gt_total(self):
formatted = ctr.format(elapsed=50, width=80)
self.assertEqual(formatted, u'350 | 50 1.0 | 100 | 150')

def test_subcounter_count_0(self):
"""
When all of count is covered by subcounters, nothing should print for main counter
"""

ctr = Counter(stream=self.tty.stdout, total=100, bar_format=u'{bar}')
term = ctr.manager.term
ctr.count = 50
ctr.add_subcounter('yellow', count=44)
ctr.add_subcounter('blue', count=4)
ctr.add_subcounter('red', count=2)

formatted = ctr.format(width=80)
bartext = term.red(BLOCK*2) + term.blue(BLOCK*3) + term.yellow(BLOCK*35) + ' ' * 40
self.assertEqual(formatted, bartext)

def test_close(self):
manager = MockManager()

Expand Down

0 comments on commit 1ef3f89

Please sign in to comment.