Beispiel #1
0
    def test_equality(self):
        """
        L{CharacterAttribute}s must have matching character attribute values
        (bold, blink, underline, etc) with the same values to be considered
        equal.
        """
        self.assertEqual(helper.CharacterAttribute(),
                         helper.CharacterAttribute())

        self.assertEqual(helper.CharacterAttribute(),
                         helper.CharacterAttribute(charset=G0))

        self.assertEqual(
            helper.CharacterAttribute(
                bold=True,
                underline=True,
                blink=False,
                reverseVideo=True,
                foreground=helper.BLUE,
            ),
            helper.CharacterAttribute(
                bold=True,
                underline=True,
                blink=False,
                reverseVideo=True,
                foreground=helper.BLUE,
            ),
        )

        self.assertNotEqual(helper.CharacterAttribute(),
                            helper.CharacterAttribute(charset=G1))

        self.assertNotEqual(helper.CharacterAttribute(bold=True),
                            helper.CharacterAttribute(bold=False))
Beispiel #2
0
 def serialize(self, write, attrs=None):
     if attrs is None:
         attrs = helper.CharacterAttribute()
     for ch in self.children:
         if isinstance(ch, _Attribute):
             ch.serialize(write, attrs.copy())
         else:
             write(attrs.toVT102())
             write(ch)
 def setUp(self):
     self.attrs = helper.CharacterAttribute()