예제 #1
0
    def test_redefined_style(self):
        formatter = OutputFormatter(True)

        style = OutputFormatterStyle('blue', 'white')
        formatter.set_style('info', style)

        self.assertEqual('\033[34;47msome custom msg\033[0m',
                         formatter.format('<info>some custom msg</info>'))
예제 #2
0
    def test_redefined_style(self):
        formatter = OutputFormatter(True)

        style = OutputFormatterStyle('blue', 'white')
        formatter.set_style('info', style)

        self.assertEqual(
            '\033[34;47msome custom msg\033[0m',
            formatter.format('<info>some custom msg</info>')
        )
예제 #3
0
    def test_new_style(self):
        formatter = OutputFormatter(True)

        style = OutputFormatterStyle('blue', 'white')
        formatter.set_style('test', style)

        self.assertEqual(style, formatter.get_style('test'))
        self.assertNotEqual(style, formatter.get_style('info'))

        style = OutputFormatterStyle('blue', 'white')
        formatter.set_style('b', style)

        self.assertEqual(
            '\033[34;47msome \033[0m\033[34;47mcustom\033[0m\033[34;47m msg\033[0m',
            formatter.format('<test>some <b>custom</b> msg</test>'))
예제 #4
0
    def test_new_style(self):
        formatter = OutputFormatter(True)

        style = OutputFormatterStyle('blue', 'white')
        formatter.set_style('test', style)

        self.assertEqual(style, formatter.get_style('test'))
        self.assertNotEqual(style, formatter.get_style('info'))

        style = OutputFormatterStyle('blue', 'white')
        formatter.set_style('b', style)

        self.assertEqual(
            '\033[34;47msome \033[0m\033[34;47mcustom\033[0m\033[34;47m msg\033[0m',
            formatter.format('<test>some <b>custom</b> msg</test>')
        )