Exemplo n.º 1
0
    def test_no_message(self):
        """Function:  test_no_message

        Description:  Test with no message passed.

        Arguments:

        """

        bar = gen_class.ProgressBar(None, self.width, self.progress_sym,
                                    self.empty_sym)

        with gen_libs.no_std_out():
            self.assertFalse(bar.update(50))
Exemplo n.º 2
0
    def test_fifty_percent(self):
        """Function:  test_fifty_percent

        Description:  Test update method with 50 percent completed.

        Arguments:

        """

        bar = gen_class.ProgressBar(self.msg, self.width, self.progress_sym,
                                    self.empty_sym)

        with gen_libs.no_std_out():
            self.assertFalse(bar.update(50))
Exemplo n.º 3
0
    def test_width_zero(self):

        """Function:  test_width_zero

        Description:  Test __init__ method with zero for width argument.

        Arguments:

        """

        bar = gen_class.ProgressBar(self.msg, 0)

        self.assertEqual((bar.msg, bar.width, bar.progress_sym, bar.empty_sym),
                         (self.msg, 20, self.progress_sym, self.empty_sym))
Exemplo n.º 4
0
    def test_user_values(self):

        """Function:  test_user_values

        Description:  Test __init__ method with user values for arguments.

        Arguments:

        """

        bar = gen_class.ProgressBar(self.msg, 30, "@", "#")

        self.assertEqual((bar.msg, bar.width, bar.progress_sym, bar.empty_sym),
                         (self.msg, 30, "@", "#"))
Exemplo n.º 5
0
    def test_default(self):

        """Function:  test_default

        Description:  Test __init__ method with default arguments.

        Arguments:

        """

        bar = gen_class.ProgressBar(self.msg)

        self.assertEqual((bar.msg, bar.width, bar.progress_sym, bar.empty_sym),
                         (self.msg, self.width, self.progress_sym,
                          self.empty_sym))
Exemplo n.º 6
0
    def test_fifty_percent(self, mock_bar):
        """Function:  test_fifty_percent

        Description:  Test calc_and_update method with 50 percent completed.

        Arguments:

        """

        mock_bar.return_value = True

        bar = gen_class.ProgressBar(self.msg, self.width, self.progress_sym,
                                    self.empty_sym)

        self.assertFalse(bar.calc_and_update(50, 100))
Exemplo n.º 7
0
    def test_zero_one(self, mock_bar):
        """Function:  test_zero_one

        Description:  Test calc_and_update method with zero and one arguments.

        Arguments:

        """

        mock_bar.return_value = True

        bar = gen_class.ProgressBar(self.msg, self.width, self.progress_sym,
                                    self.empty_sym)

        self.assertFalse(bar.calc_and_update(0, 1))