def test_clear(ansi_io): bar = ProgressBar(ansi_io, 50, 0) bar.start() bar.set_progress(25) bar.clear() output = [ " 0/50 [>---------------------------] 0%", " 25/50 [==============>-------------] 50%", "", ] expected = generate_output(output) assert expected == ansi_io.fetch_error()
def test_multiline_format(ansi_io): bar = ProgressBar(ansi_io, 3, 0) bar.set_format("%bar%\nfoobar") bar.start() bar.advance() bar.clear() bar.finish() output = [ ">---------------------------\nfoobar", "=========>------------------\nfoobar", "\n", "============================\nfoobar", ] expected = generate_output(output) assert expected == ansi_io.fetch_error()