Exemplo n.º 1
0
    def test_multibyte_support(self):
        output = self.get_output_stream()
        bar = ProgressBar(output)
        bar.start()
        bar.set_bar_character('■')
        bar.advance(3)

        expected = self.generate_output([
            '    0 [>---------------------------]',
            '    3 [■■■>------------------------]'
        ])

        self.assertEqual(expected, self.get_output_content(output))
Exemplo n.º 2
0
    def test_customizations(self):
        output = self.get_output_stream()
        bar = ProgressBar(output, 10)
        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()

        expected = self.generate_output(
            ['  0/10 [/         ]   0%', '  1/10 [_/        ]  10%'])

        self.assertEqual(expected, self.get_output_content(output))