Skip to content

Commit

Permalink
tests: reset/unpause when disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Feb 10, 2021
1 parent bd176fe commit bf2a5e7
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/tests_tqdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"""
Expand Down

0 comments on commit bf2a5e7

Please sign in to comment.