示例#1
0
 def test_format_default(self):
     console = Console()
     output = console.format('The quick brown fox jumps over the lazy dog')
     self.assertEqual(
         repr(output),
         repr('The quick brown fox jumps over the lazy dog' + ' ' * 37)
     )
示例#2
0
 def test_format_many_options(self):
     console = Console()
     output = console.format(
         'The quick brown fox jumps over the lazy dog',
         fg_color='RED', bg_color='YELLOW', font='BOLD', min_length=10
     )
     self.assertEqual(
         repr(output),
         repr(
             '\x1b[2m\x1b[31m\x1b[43m'
             'The quick brown fox jumps over the lazy dog'
             '\x1b[49m\x1b[39m\x1b[0m'
         )
     )
示例#3
0
 def test_format_fg_color(self):
     console = Console()
     output = console.format(
         'The quick brown fox jumps over the lazy dog', fg_color='RED'
     )
     self.assertEqual(
         repr(output),
         repr(
             '\x1b[31m'
             'The quick brown fox jumps over the lazy dog'
             '\x1b[39m' +
             ' ' * 27
         )
     )