示例#1
0
 def test_str_input_with_right_all(self):
     out = apply_color('PyTColor', color='red', bg_color='green', style='underline')
     self.assertEqual(out, '\033[4m\033[42m\033[31mPyTColor\033[0m')
示例#2
0
 def test_list_input_with_right_all(self):
     out = apply_color(['Python', 'Terminal', 'Color'], color='red', bg_color='green', style='underline')
     self.assertEqual(
         out,
         '\033[4m\033[42m\033[31mPython Terminal Color\033[0m'
     )
示例#3
0
 def test_str_input_with_wrong_style(self):
     out = apply_color('PyTColor', style='123test123')
     self.assertEqual(out, 'PyTColor\033[0m')
示例#4
0
 def test_list_input_with_wrong_style(self):
     out = apply_color(['Python', 'Terminal', 'Color'], style='123test123')
     self.assertEqual(
         out,
         'Python Terminal Color\033[0m'
     )
示例#5
0
 def test_str_input_with_right_style(self):
     out = apply_color('PyTColor', style='underline')
     self.assertEqual(out, '\033[4mPyTColor\033[0m')
示例#6
0
 def test_list_input_with_right_style(self):
     out = apply_color(['Python', 'Terminal', 'Color'], style='underline')
     self.assertEqual(
         out,
         '\033[4mPython Terminal Color\033[0m'
     )
示例#7
0
 def test_list_input_with_right_bg_color(self):
     out = apply_color(['Python', 'Terminal', 'Color'], bg_color='red')
     self.assertEqual(
         out,
         '\033[41mPython Terminal Color\033[0m'
     )
示例#8
0
 def test_str_input_with_right_bg_color(self):
     out = apply_color('PyTColor', bg_color='red')
     self.assertEqual(out, '\033[41mPyTColor\033[0m')
示例#9
0
 def test_str_input_with_all_wrong_color(self):
     out = apply_color('PyTColor', color='123', bg_color='green', style='underline')
     self.assertEqual(out, '\033[4m\033[42mPyTColor\033[0m')
示例#10
0
 def test_list_input_with_all_wrong_style(self):
     out = apply_color(['Python', 'Terminal', 'Color'], color='red', bg_color='green', style='123')
     self.assertEqual(
         out,
         '\033[42m\033[31mPython Terminal Color\033[0m'
     )
示例#11
0
 def test_str_input_with_wrong_all(self):
     out = apply_color('PyTColor', color='123', bg_color='test', style='123')
     self.assertEqual(out, 'PyTColor\033[0m')