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>'))
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>') )
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>'))
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>') )