    def test_controlcode_parser(self):
        """
        Check ControlCodeParser  works as expected
        """
        parser = ControlCodeParser()
        parser.reset("\0\b\ra[", colours=(1, 2, 3))
        tokens = parser.parse()
        self.assertEqual(next(tokens), (0, Parser.CHANGE_COLOURS, (1, 2, 3)))
        self.assertEqual(next(tokens), (0, Parser.DISPLAY_TEXT, "^@"))
        self.assertEqual(next(tokens), (1, Parser.DISPLAY_TEXT, "^H"))
        self.assertEqual(next(tokens), (2, Parser.DISPLAY_TEXT, "^M"))
        self.assertEqual(next(tokens), (3, Parser.DISPLAY_TEXT, "a"))
        self.assertEqual(next(tokens), (4, Parser.DISPLAY_TEXT, "["))
Check ControlCodeParser  works as expected
tests/test_parsers.py