def test_simple_bar_with_percent(self): """Tests the simple percent animation bar""" total = 20 bar = SimplePercentProgressBar() bar.increase(50) self.assertEqual("[{0}>{1}]({2}%)".format('=' * (total // 2 - 1), ' ' * (total // 2), 100 * (total // 2) // total), bar.progress_bar)
def test_simple_bar_with_percent(self): """Tests the simple percent animation bar""" total = 20 bar = SimplePercentProgressBar() bar.increase(50) self.assertEqual( "[{0}>{1}]({2}%)".format('=' * (total // 2 - 1), ' ' * (total // 2), 100 * (total // 2) // total), bar.progress_bar)
def show_simple_percent_animation(): bar = SimplePercentProgressBar() bar.show_progress_bar() while (not bar.completed()): time.sleep(0.3) bar.increase(random.randint(1, 10)) bar.show_progress_bar()
def show_simple_percent_animation(): bar = SimplePercentProgressBar() bar.show_progress_bar() while(not bar.completed()): time.sleep(0.3) bar.increase(random.randint(1, 10)) bar.show_progress_bar()
def show_up_down_animation(): bar = SimplePercentProgressBar() bar.show_progress_bar() up = False for i in range(5): if up: up = False bar.decrease(1) else: up = True bar.increase(1) while (bar.progress > 0 and bar.progress < 100): time.sleep(0.1) factor = random.randint(1, 10) if up: bar.increase(factor) else: bar.decrease(factor) bar.show_progress_bar()
def show_up_down_animation(): bar = SimplePercentProgressBar() bar.show_progress_bar() up = False for i in range(5): if up: up = False bar.decrease(1) else: up = True bar.increase(1) while(bar.progress > 0 and bar.progress < 100): time.sleep(0.1) factor = random.randint(1, 10) if up: bar.increase(factor) else: bar.decrease(factor) bar.show_progress_bar()