mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-22 06:17:50 +00:00
Fix flake.
This commit is contained in:
parent
293cea6fd2
commit
f48cf88f35
@ -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 = '#'
|
||||
|
@ -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',
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user