Esempio n. 1
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>'))
Esempio n. 2
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>')
        )