twisted.conch.insults.text.flatten

Here are the examples of the python api twisted.conch.insults.text.flatten taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

40 Examples 7

Example 1

Project: mythbox
Source File: test_text.py
View license
    def testMinus(self):
        self.assertEquals(
            text.flatten(
                A.bold[A.blink['Hello', -A.bold[' world'], '.']],
                self.attrs),
            '\x1b[1;5mHello\x1b[0;5m world\x1b[1;5m.')

Example 2

Project: mythbox
Source File: test_text.py
View license
    def testForeground(self):
        self.assertEquals(
            text.flatten(
                A.normal[A.fg.red['Hello, '], A.fg.green['world!']],
                self.attrs),
            '\x1b[31mHello, \x1b[32mworld!')

Example 3

Project: mythbox
Source File: test_text.py
View license
    def testBackground(self):
        self.assertEquals(
            text.flatten(
                A.normal[A.bg.red['Hello, '], A.bg.green['world!']],
                self.attrs),
            '\x1b[41mHello, \x1b[42mworld!')

Example 4

Project: mythbox
Source File: test_text.py
View license
    def testComplexStructure(self):
        output = A.normal[
            A.bold[
                A.bg.cyan[
                    A.fg.red[
                        "Foreground Red, Background Cyan, Bold",
                        A.blink[
                            "Blinking"],
                        -A.bold[
                            "Foreground Red, Background Cyan, normal"]],
                    A.fg.green[
                        "Foreground Green, Background Cyan, Bold"]]]]

        self.assertEquals(
            text.flatten(output, self.attrs),
            "\x1b[1;31;46mForeground Red, Background Cyan, Bold"
            "\x1b[5mBlinking"
            "\x1b[0;31;46mForeground Red, Background Cyan, normal"
            "\x1b[1;32;46mForeground Green, Background Cyan, Bold")

Example 5

Project: mythbox
Source File: test_text.py
View license
    def testNesting(self):
        self.assertEquals(
            text.flatten(A.bold['Hello, ', A.underline['world.']], self.attrs),
            '\x1b[1mHello, \x1b[4mworld.')

        self.assertEquals(
            text.flatten(
                A.bold[A.reverseVideo['Hello, ', A.normal['world'], '.']],
                self.attrs),
            '\x1b[1;7mHello, \x1b[0mworld\x1b[1;7m.')

Example 6

Project: mythbox
Source File: test_text.py
View license
    def testMinus(self):
        self.assertEquals(
            text.flatten(
                A.bold[A.blink['Hello', -A.bold[' world'], '.']],
                self.attrs),
            '\x1b[1;5mHello\x1b[0;5m world\x1b[1;5m.')

Example 7

Project: mythbox
Source File: test_text.py
View license
    def testForeground(self):
        self.assertEquals(
            text.flatten(
                A.normal[A.fg.red['Hello, '], A.fg.green['world!']],
                self.attrs),
            '\x1b[31mHello, \x1b[32mworld!')

Example 8

Project: mythbox
Source File: test_text.py
View license
    def testBackground(self):
        self.assertEquals(
            text.flatten(
                A.normal[A.bg.red['Hello, '], A.bg.green['world!']],
                self.attrs),
            '\x1b[41mHello, \x1b[42mworld!')

Example 9

Project: mythbox
Source File: test_text.py
View license
    def testComplexStructure(self):
        output = A.normal[
            A.bold[
                A.bg.cyan[
                    A.fg.red[
                        "Foreground Red, Background Cyan, Bold",
                        A.blink[
                            "Blinking"],
                        -A.bold[
                            "Foreground Red, Background Cyan, normal"]],
                    A.fg.green[
                        "Foreground Green, Background Cyan, Bold"]]]]

        self.assertEquals(
            text.flatten(output, self.attrs),
            "\x1b[1;31;46mForeground Red, Background Cyan, Bold"
            "\x1b[5mBlinking"
            "\x1b[0;31;46mForeground Red, Background Cyan, normal"
            "\x1b[1;32;46mForeground Green, Background Cyan, Bold")

Example 10

Project: mythbox
Source File: test_text.py
View license
    def testNesting(self):
        self.assertEquals(
            text.flatten(A.bold['Hello, ', A.underline['world.']], self.attrs),
            '\x1b[1mHello, \x1b[4mworld.')

        self.assertEquals(
            text.flatten(
                A.bold[A.reverseVideo['Hello, ', A.normal['world'], '.']],
                self.attrs),
            '\x1b[1;7mHello, \x1b[0mworld\x1b[1;7m.')

Example 11

Project: SubliminalCollaborator
Source File: test_text.py
View license
    def testMinus(self):
        self.assertEqual(
            text.flatten(
                A.bold[A.blink['Hello', -A.bold[' world'], '.']],
                self.attrs),
            '\x1b[1;5mHello\x1b[0;5m world\x1b[1;5m.')

Example 12

Project: SubliminalCollaborator
Source File: test_text.py
View license
    def testForeground(self):
        self.assertEqual(
            text.flatten(
                A.normal[A.fg.red['Hello, '], A.fg.green['world!']],
                self.attrs),
            '\x1b[31mHello, \x1b[32mworld!')

Example 13

Project: SubliminalCollaborator
Source File: test_text.py
View license
    def testBackground(self):
        self.assertEqual(
            text.flatten(
                A.normal[A.bg.red['Hello, '], A.bg.green['world!']],
                self.attrs),
            '\x1b[41mHello, \x1b[42mworld!')

Example 14

Project: SubliminalCollaborator
Source File: test_text.py
View license
    def testComplexStructure(self):
        output = A.normal[
            A.bold[
                A.bg.cyan[
                    A.fg.red[
                        "Foreground Red, Background Cyan, Bold",
                        A.blink[
                            "Blinking"],
                        -A.bold[
                            "Foreground Red, Background Cyan, normal"]],
                    A.fg.green[
                        "Foreground Green, Background Cyan, Bold"]]]]

        self.assertEqual(
            text.flatten(output, self.attrs),
            "\x1b[1;31;46mForeground Red, Background Cyan, Bold"
            "\x1b[5mBlinking"
            "\x1b[0;31;46mForeground Red, Background Cyan, normal"
            "\x1b[1;32;46mForeground Green, Background Cyan, Bold")

Example 15

Project: SubliminalCollaborator
Source File: test_text.py
View license
    def testNesting(self):
        self.assertEqual(
            text.flatten(A.bold['Hello, ', A.underline['world.']], self.attrs),
            '\x1b[1mHello, \x1b[4mworld.')

        self.assertEqual(
            text.flatten(
                A.bold[A.reverseVideo['Hello, ', A.normal['world'], '.']],
                self.attrs),
            '\x1b[1;7mHello, \x1b[0mworld\x1b[1;7m.')

Example 16

Project: SubliminalCollaborator
Source File: test_text.py
View license
    def testMinus(self):
        self.assertEqual(
            text.flatten(
                A.bold[A.blink['Hello', -A.bold[' world'], '.']],
                self.attrs),
            '\x1b[1;5mHello\x1b[0;5m world\x1b[1;5m.')

Example 17

Project: SubliminalCollaborator
Source File: test_text.py
View license
    def testForeground(self):
        self.assertEqual(
            text.flatten(
                A.normal[A.fg.red['Hello, '], A.fg.green['world!']],
                self.attrs),
            '\x1b[31mHello, \x1b[32mworld!')

Example 18

Project: SubliminalCollaborator
Source File: test_text.py
View license
    def testBackground(self):
        self.assertEqual(
            text.flatten(
                A.normal[A.bg.red['Hello, '], A.bg.green['world!']],
                self.attrs),
            '\x1b[41mHello, \x1b[42mworld!')

Example 19

Project: SubliminalCollaborator
Source File: test_text.py
View license
    def testComplexStructure(self):
        output = A.normal[
            A.bold[
                A.bg.cyan[
                    A.fg.red[
                        "Foreground Red, Background Cyan, Bold",
                        A.blink[
                            "Blinking"],
                        -A.bold[
                            "Foreground Red, Background Cyan, normal"]],
                    A.fg.green[
                        "Foreground Green, Background Cyan, Bold"]]]]

        self.assertEqual(
            text.flatten(output, self.attrs),
            "\x1b[1;31;46mForeground Red, Background Cyan, Bold"
            "\x1b[5mBlinking"
            "\x1b[0;31;46mForeground Red, Background Cyan, normal"
            "\x1b[1;32;46mForeground Green, Background Cyan, Bold")

Example 20

Project: SubliminalCollaborator
Source File: test_text.py
View license
    def testNesting(self):
        self.assertEqual(
            text.flatten(A.bold['Hello, ', A.underline['world.']], self.attrs),
            '\x1b[1mHello, \x1b[4mworld.')

        self.assertEqual(
            text.flatten(
                A.bold[A.reverseVideo['Hello, ', A.normal['world'], '.']],
                self.attrs),
            '\x1b[1;7mHello, \x1b[0mworld\x1b[1;7m.')

Example 21

Project: mythbox
Source File: test_text.py
View license
    def testTrivial(self):
        self.assertEquals(
            text.flatten(A.normal['Hello, world.'], self.attrs),
            'Hello, world.')

Example 22

Project: mythbox
Source File: test_text.py
View license
    def testBold(self):
        self.assertEquals(
            text.flatten(A.bold['Hello, world.'], self.attrs),
            '\x1b[1mHello, world.')

Example 23

Project: mythbox
Source File: test_text.py
View license
    def testUnderline(self):
        self.assertEquals(
            text.flatten(A.underline['Hello, world.'], self.attrs),
            '\x1b[4mHello, world.')

Example 24

Project: mythbox
Source File: test_text.py
View license
    def testBlink(self):
        self.assertEquals(
            text.flatten(A.blink['Hello, world.'], self.attrs),
            '\x1b[5mHello, world.')

Example 25

Project: mythbox
Source File: test_text.py
View license
    def testReverseVideo(self):
        self.assertEquals(
            text.flatten(A.reverseVideo['Hello, world.'], self.attrs),
            '\x1b[7mHello, world.')

Example 26

Project: mythbox
Source File: test_text.py
View license
    def testTrivial(self):
        self.assertEquals(
            text.flatten(A.normal['Hello, world.'], self.attrs),
            'Hello, world.')

Example 27

Project: mythbox
Source File: test_text.py
View license
    def testBold(self):
        self.assertEquals(
            text.flatten(A.bold['Hello, world.'], self.attrs),
            '\x1b[1mHello, world.')

Example 28

Project: mythbox
Source File: test_text.py
View license
    def testUnderline(self):
        self.assertEquals(
            text.flatten(A.underline['Hello, world.'], self.attrs),
            '\x1b[4mHello, world.')

Example 29

Project: mythbox
Source File: test_text.py
View license
    def testBlink(self):
        self.assertEquals(
            text.flatten(A.blink['Hello, world.'], self.attrs),
            '\x1b[5mHello, world.')

Example 30

Project: mythbox
Source File: test_text.py
View license
    def testReverseVideo(self):
        self.assertEquals(
            text.flatten(A.reverseVideo['Hello, world.'], self.attrs),
            '\x1b[7mHello, world.')

Example 31

Project: SubliminalCollaborator
Source File: test_text.py
View license
    def testTrivial(self):
        self.assertEqual(
            text.flatten(A.normal['Hello, world.'], self.attrs),
            'Hello, world.')

Example 32

Project: SubliminalCollaborator
Source File: test_text.py
View license
    def testBold(self):
        self.assertEqual(
            text.flatten(A.bold['Hello, world.'], self.attrs),
            '\x1b[1mHello, world.')

Example 33

Project: SubliminalCollaborator
Source File: test_text.py
View license
    def testUnderline(self):
        self.assertEqual(
            text.flatten(A.underline['Hello, world.'], self.attrs),
            '\x1b[4mHello, world.')

Example 34

Project: SubliminalCollaborator
Source File: test_text.py
View license
    def testBlink(self):
        self.assertEqual(
            text.flatten(A.blink['Hello, world.'], self.attrs),
            '\x1b[5mHello, world.')

Example 35

Project: SubliminalCollaborator
Source File: test_text.py
View license
    def testReverseVideo(self):
        self.assertEqual(
            text.flatten(A.reverseVideo['Hello, world.'], self.attrs),
            '\x1b[7mHello, world.')

Example 36

Project: SubliminalCollaborator
Source File: test_text.py
View license
    def testTrivial(self):
        self.assertEqual(
            text.flatten(A.normal['Hello, world.'], self.attrs),
            'Hello, world.')

Example 37

Project: SubliminalCollaborator
Source File: test_text.py
View license
    def testBold(self):
        self.assertEqual(
            text.flatten(A.bold['Hello, world.'], self.attrs),
            '\x1b[1mHello, world.')

Example 38

Project: SubliminalCollaborator
Source File: test_text.py
View license
    def testUnderline(self):
        self.assertEqual(
            text.flatten(A.underline['Hello, world.'], self.attrs),
            '\x1b[4mHello, world.')

Example 39

Project: SubliminalCollaborator
Source File: test_text.py
View license
    def testBlink(self):
        self.assertEqual(
            text.flatten(A.blink['Hello, world.'], self.attrs),
            '\x1b[5mHello, world.')

Example 40

Project: SubliminalCollaborator
Source File: test_text.py
View license
    def testReverseVideo(self):
        self.assertEqual(
            text.flatten(A.reverseVideo['Hello, world.'], self.attrs),
            '\x1b[7mHello, world.')