Beispiel #1
0
    def test_clear(self):
        output = self.get_output_stream()
        bar = ProgressBar(output, 50)
        bar.start()
        bar.set_progress(25)
        bar.clear()

        expected = self.generate_output([
            '  0/50 [>---------------------------]   0%',
            ' 25/50 [==============>-------------]  50%',
            '                                          '
        ])

        self.assertEqual(expected, self.get_output_content(output))
Beispiel #2
0
    def test_multiline_format(self):
        output = self.get_output_stream()
        bar = ProgressBar(output, 3)
        bar.set_format('%bar%\nfoobar')

        bar.start()
        bar.advance()
        bar.clear()
        bar.finish()

        expected = self.generate_output([
            '>---------------------------\nfoobar',
            '=========>------------------\nfoobar                      ',
            '                            \n                            ',
            '============================\nfoobar                      '
        ])

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