tests: reset/unpause when disabled

This commit is contained in:
Casper da Costa-Luis 2021-02-10 14:00:31 +00:00
parent bd176fec18
commit bf2a5e701d
No known key found for this signature in database
GPG Key ID: 986B408043AE090D
1 changed files with 26 additions and 0 deletions

View File

@ -1172,6 +1172,18 @@ def test_unpause():
assert r_before == r_after
def test_disabled_unpause(capsys):
"""Test disabled unpause"""
with tqdm(total=10, disable=True) as t:
t.update()
t.unpause()
t.update()
print(t)
out, err = capsys.readouterr()
assert not err
assert out == ' 0%| | 0/10 [00:00<?, ?it/s]\n'
def test_reset():
"""Test resetting a bar for re-use"""
with closing(StringIO()) as our_file:
@ -1186,6 +1198,20 @@ def test_reset():
assert '| 10/12' in our_file.getvalue()
def test_disabled_reset(capsys):
"""Test disabled reset"""
with tqdm(total=10, disable=True) as t:
t.update(9)
t.reset()
t.update()
t.reset(total=12)
t.update(10)
print(t)
out, err = capsys.readouterr()
assert not err
assert out == ' 0%| | 0/12 [00:00<?, ?it/s]\n'
@mark.skipif(nt_and_no_colorama, reason="Windows without colorama")
def test_position():
"""Test positioned progress bars"""