Fix flake.

This commit is contained in:
Itamar Turner-Trauring 2021-06-03 09:45:29 -04:00
parent 293cea6fd2
commit f48cf88f35
2 changed files with 8 additions and 8 deletions

View File

@ -61,7 +61,7 @@ def _get_json_for_cap(options, cap):
'uri/%s?t=json' % url_quote(cap),
)
def pretty_progress(percent, size=10, ascii=False):
def pretty_progress(percent, size=10, output_ascii=False):
"""
Displays a unicode or ascii based progress bar of a certain
length. Should we just depend on a library instead?
@ -72,7 +72,7 @@ def pretty_progress(percent, size=10, ascii=False):
curr = int(percent / 100.0 * size)
part = (percent / (100.0 / size)) - curr
if ascii:
if output_ascii:
part = int(part * 4)
part = '.oO%'[part]
block_chr = '#'

View File

@ -60,30 +60,30 @@ class FakeStatus(object):
class ProgressBar(unittest.TestCase):
def test_ascii0(self):
prog = pretty_progress(80.0, size=10, ascii=True)
prog = pretty_progress(80.0, size=10, output_ascii=True)
self.assertEqual('########. ', prog)
def test_ascii1(self):
prog = pretty_progress(10.0, size=10, ascii=True)
prog = pretty_progress(10.0, size=10, output_ascii=True)
self.assertEqual('#. ', prog)
def test_ascii2(self):
prog = pretty_progress(13.0, size=10, ascii=True)
prog = pretty_progress(13.0, size=10, output_ascii=True)
self.assertEqual('#o ', prog)
def test_ascii3(self):
prog = pretty_progress(90.0, size=10, ascii=True)
prog = pretty_progress(90.0, size=10, output_ascii=True)
self.assertEqual('#########.', prog)
def test_unicode0(self):
self.assertEqual(
pretty_progress(82.0, size=10, ascii=False),
pretty_progress(82.0, size=10, output_ascii=False),
u'\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258e ',
)
def test_unicode1(self):
self.assertEqual(
pretty_progress(100.0, size=10, ascii=False),
pretty_progress(100.0, size=10, output_ascii=False),
u'\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588',
)