def show_color_animation(): bar = SimpleColorBar() bar.show_progress_bar() while (not bar.completed()): time.sleep(0.2) bar.increase(1) bar.show_progress_bar()
def test_50_percent_color_bar(self): """Tests the color 50 percent bar""" total = 20 bar = SimpleColorBar() bar.increase(50) format = GREEN + "[" + COL_RESET +\ BLUE + "{0}" + COL_RESET +\ RED + ">" + COL_RESET +\ MAGENTA + "{1}" + COL_RESET +\ GREEN + "]" + COL_RESET self.assertEqual( format.format('=' * (total // 2 - 1), '.' * (total // 2)), bar.progress_bar)
def show_color_animation(): bar = SimpleColorBar() bar.show_progress_bar() while(not bar.completed()): time.sleep(0.2) bar.increase(1) bar.show_progress_bar()
def test_50_percent_color_bar(self): """Tests the color 50 percent bar""" total = 20 bar = SimpleColorBar() bar.increase(50) format = GREEN + "[" + COL_RESET +\ BLUE + "{0}" + COL_RESET +\ RED + ">" + COL_RESET +\ MAGENTA + "{1}" + COL_RESET +\ GREEN + "]" + COL_RESET self.assertEqual(format.format('=' * (total // 2 - 1), '.' * (total // 2)), bar.progress_bar)
def show_different_colors(): bar = SimpleColorBar(left_limit_clr=GREEN, right_limit_clr=GREEN, head_clr=WHITE, empty_clr=WHITE, filled_clr=RED) bar.increase(50) bar.show_progress_bar() print("") bar = SimpleColorBar() bar.increase(70) bar.show_progress_bar() print("") bar = SimpleColorBar(left_limit_clr=CYAN, right_limit_clr=CYAN, head_clr=MAGENTA, empty_clr=GREEN, filled_clr=YELLOW) bar.increase(80) bar.show_progress_bar() print("") bar = SimpleColorBar(left_limit_clr=MAGENTA, right_limit_clr=RED, head_clr=BLUE, empty_clr=YELLOW, filled_clr=GREEN) bar.increase(30) bar.show_progress_bar() print("")