cosmetic: pep8 and io is actually just out

This commit is contained in:
Antoine Beaupré 2015-10-18 21:06:56 -04:00
parent 4c6915cce5
commit 158e6b529a
1 changed files with 10 additions and 10 deletions

View File

@ -413,25 +413,25 @@ def test_stats_basic(stats):
assert stats.osize == stats.csize == 20
assert stats.usize == 10
def tests_stats_progress(stats, columns = 80):
def tests_stats_progress(stats, columns=80):
os.environ['COLUMNS'] = str(columns)
io = StringIO()
stats.show_progress(stream=io)
out = StringIO()
stats.show_progress(stream=out)
s = '10 B O 10 B C 10 B D 0 N '
buf = ' ' * (columns - len(s))
assert io.getvalue() == s + buf + "\r"
assert out.getvalue() == s + buf + "\r"
io = StringIO()
out = StringIO()
stats.update(10**3, 0, unique=False)
stats.show_progress(item={b'path': 'foo'}, final=False, stream=io)
stats.show_progress(item={b'path': 'foo'}, final=False, stream=out)
s = '1.01 kB O 10 B C 10 B D 0 N foo'
buf = ' ' * (columns - len(s))
assert io.getvalue() == s + buf + "\r"
io = StringIO()
stats.show_progress(item={b'path': 'foo'*40}, final=False, stream=io)
assert out.getvalue() == s + buf + "\r"
out = StringIO()
stats.show_progress(item={b'path': 'foo'*40}, final=False, stream=out)
s = '1.01 kB O 10 B C 10 B D 0 N foofoofoofoofoofoofoofo...oofoofoofoofoofoofoofoofoo'
buf = ' ' * (columns - len(s))
assert io.getvalue() == s + buf + "\r"
assert out.getvalue() == s + buf + "\r"
def test_stats_format(stats):
assert str(stats) == """\