示例#1
0
def test_customizations(ansi_io):
    bar = ProgressBar(ansi_io, 10, 0)
    bar.set_bar_width(10)
    bar.set_bar_character("_")
    bar.set_empty_bar_character(" ")
    bar.set_progress_character("/")
    bar.set_format(" %current%/%max% [%bar%] %percent:3s%%")
    bar.start()
    bar.advance()

    output = ["  0/10 [/         ]   0%", "  1/10 [_/        ]  10%"]

    expected = "\x0D" + "\x0D".join(output)

    assert expected == ansi_io.fetch_error()
示例#2
0
 def progress_bar(self, items) -> ProgressBar:
     bar = ProgressBar(self.io(), items)
     bar.set_bar_character("■")
     bar.set_progress_character('')
     return bar