

def testColorAttributes(self):
    s1 = 'Merry xmas'
    s2 = 'Just kidding'
    self.term.selectGraphicRendition((helper.FOREGROUND + helper.RED), (helper.BACKGROUND + helper.GREEN))
    self.term.write((s1 + '\n'))
    self.term.selectGraphicRendition(NORMAL)
    self.term.write((s2 + '\n'))
    for i in range(len(s1)):
        ch = self.term.getCharacter(i, 0)
        self.assertEqual(ch[0], s1[i])
        self.assertEqual(ch[1].charset, G0)
        self.assertEqual(ch[1].bold, False)
        self.assertEqual(ch[1].underline, False)
        self.assertEqual(ch[1].blink, False)
        self.assertEqual(ch[1].reverseVideo, False)
        self.assertEqual(ch[1].foreground, helper.RED)
        self.assertEqual(ch[1].background, helper.GREEN)
    for i in range(len(s2)):
        ch = self.term.getCharacter(i, 1)
        self.assertEqual(ch[0], s2[i])
        self.assertEqual(ch[1].charset, G0)
        self.assertEqual(ch[1].bold, False)
        self.assertEqual(ch[1].underline, False)
        self.assertEqual(ch[1].blink, False)
        self.assertEqual(ch[1].reverseVideo, False)
        self.assertEqual(ch[1].foreground, helper.WHITE)
        self.assertEqual(ch[1].background, helper.BLACK)

dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/conch/test/test_helper.py BufferTestCase.testColorAttributes/original