mirror of https://github.com/tqdm/tqdm.git
tests: reset/unpause when disabled
This commit is contained in:
parent
bd176fec18
commit
bf2a5e701d
|
@ -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"""
|
||||
|
|
Loading…
Reference in New Issue