How to use the cleo.formatters.OutputFormatterStyle function in cleo

To help you get started, we’ve selected a few cleo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sdispater / cleo / tests / formatters / test_output_formatter_style.py View on Github external
def test_init(self):
        style = OutputFormatterStyle('green', 'black', ['bold', 'underscore'])
        self.assertEqual('\033[32;40;1;4mfoo\033[0m', style.apply('foo'))

        style = OutputFormatterStyle('red', None, ['blink'])
        self.assertEqual('\033[31;5mfoo\033[0m', style.apply('foo'))

        style = OutputFormatterStyle(None, 'white')
        self.assertEqual('\033[47mfoo\033[0m', style.apply('foo'))
github sdispater / cleo / tests / formatters / test_output_formatter_style.py View on Github external
def test_init(self):
        style = OutputFormatterStyle('green', 'black', ['bold', 'underscore'])
        self.assertEqual('\033[32;40;1;4mfoo\033[0m', style.apply('foo'))

        style = OutputFormatterStyle('red', None, ['blink'])
        self.assertEqual('\033[31;5mfoo\033[0m', style.apply('foo'))

        style = OutputFormatterStyle(None, 'white')
        self.assertEqual('\033[47mfoo\033[0m', style.apply('foo'))
github sdispater / cleo / tests / formatters / test_output_formatter_style.py View on Github external
def test_init(self):
        style = OutputFormatterStyle('green', 'black', ['bold', 'underscore'])
        self.assertEqual('\033[32;40;1;4mfoo\033[0m', style.apply('foo'))

        style = OutputFormatterStyle('red', None, ['blink'])
        self.assertEqual('\033[31;5mfoo\033[0m', style.apply('foo'))

        style = OutputFormatterStyle(None, 'white')
        self.assertEqual('\033[47mfoo\033[0m', style.apply('foo'))
github sdispater / cleo / tests / formatters / test_output_formatter_style_stack.py View on Github external
def test_invalid_pop(self):
        stack = OutputFormatterStyleStack()
        s1 = OutputFormatterStyle('white', 'black')
        s2 = OutputFormatterStyle('yellow', 'blue')
        stack.push(s1)

        self.assertRaises(
            Exception,
            stack.pop,
            s2
        )
github sdispater / cleo / tests / formatters / test_output_formatter_style_stack.py View on Github external
def test_pop(self):
        stack = OutputFormatterStyleStack()
        s1 = OutputFormatterStyle('white', 'black')
        s2 = OutputFormatterStyle('yellow', 'blue')
        stack.push(s1)
        stack.push(s2)

        self.assertEqual(s2, stack.pop())
        self.assertEqual(s1, stack.pop())
github sdispater / cleo / tests / formatters / test_output_formatter_style_stack.py View on Github external
def test_push(self):
        stack = OutputFormatterStyleStack()
        s1 = OutputFormatterStyle('white', 'black')
        s2 = OutputFormatterStyle('yellow', 'blue')
        stack.push(s1)
        stack.push(s2)

        self.assertEqual(s2, stack.get_current())

        s3 = OutputFormatterStyle('green', 'red')
        stack.push(s3)

        self.assertEqual(s3, stack.get_current())
github sdispater / cleo / tests / formatters / test_output_formatter_style_stack.py View on Github external
def test_pop_not_last(self):
        stack = OutputFormatterStyleStack()
        s1 = OutputFormatterStyle('white', 'black')
        s2 = OutputFormatterStyle('yellow', 'blue')
        s3 = OutputFormatterStyle('green', 'red')
        stack.push(s1)
        stack.push(s2)
        stack.push(s3)

        self.assertEqual(s2, stack.pop(s2))
        self.assertEqual(s1, stack.pop())
github sdispater / cleo / tests / formatters / test_output_formatter_style_stack.py View on Github external
def test_push(self):
        stack = OutputFormatterStyleStack()
        s1 = OutputFormatterStyle('white', 'black')
        s2 = OutputFormatterStyle('yellow', 'blue')
        stack.push(s1)
        stack.push(s2)

        self.assertEqual(s2, stack.get_current())

        s3 = OutputFormatterStyle('green', 'red')
        stack.push(s3)

        self.assertEqual(s3, stack.get_current())
github sdispater / cleo / tests / formatters / test_output_formatter_style_stack.py View on Github external
def test_pop_not_last(self):
        stack = OutputFormatterStyleStack()
        s1 = OutputFormatterStyle('white', 'black')
        s2 = OutputFormatterStyle('yellow', 'blue')
        s3 = OutputFormatterStyle('green', 'red')
        stack.push(s1)
        stack.push(s2)
        stack.push(s3)

        self.assertEqual(s2, stack.pop(s2))
        self.assertEqual(s1, stack.pop())
github sdispater / cleo / tests / formatters / test_output_formatter_style_stack.py View on Github external
def test_invalid_pop(self):
        stack = OutputFormatterStyleStack()
        s1 = OutputFormatterStyle('white', 'black')
        s2 = OutputFormatterStyle('yellow', 'blue')
        stack.push(s1)

        self.assertRaises(
            Exception,
            stack.pop,
            s2
        )