-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_output.py
executable file
·62 lines (48 loc) · 1.5 KB
/
test_output.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env python3
"""Test Color Output"""
import unittest
from colorful import Color
COLORS = ["black", "red", "green", "yellow", "blue", "magenta", "cyan", "white"]
STYLES = ["reset", "bold", "dim", "italic", "underline", "blink", "invert", "hide", "strike"]
class TestOutputColor(unittest.TestCase):
"""Test Output Base Color"""
title = "Color"
check = COLORS
method = ""
method_add = ""
def setUp(self):
print()
print(Color(self.title).bold().underline())
def tearDown(self):
print()
def test_loop(self):
"""Loop through colors and print"""
for index, itm in enumerate(self.check):
obj = Color(f"{index+1}.) {itm}")
if self.method:
print(getattr(obj, self.method)(itm))
else:
if hasattr(obj, self.method_add+itm):
print(getattr(obj, self.method_add+itm)())
else:
print(f"X.) *Skipping* ({self.method_add}{itm} method not found)")
class TestOutputStyle(TestOutputColor):
"""Test Output Style"""
title = "Style"
check = STYLES
method = ""
method_add = ""
class TestOutputBG(TestOutputColor):
"""Test Output BG"""
title = "Backgrounds"
check = COLORS
method = ""
method_add = "on_"
class TestOutputBright(TestOutputColor):
"""Test Output Bright"""
title = "Bright"
check = COLORS
method = ""
method_add = "bright_"
if __name__ == "__main__":
unittest.main()