    def test_ansi_terminal_parser_colours(self):
        """
        Check AnsiTerminalParser basic colours work as expected.
        """
        parser = AnsiTerminalParser()
        parser.reset("a\x1B[23ab\x1B[0mc\x1B[1md\x1B[2me\x1B[7mf\x1B[27mg\x1B[31;42mh\x1B[m", None)
        tokens = parser.parse()

        # Normal text
        self.assertEqual(next(tokens), (0, Parser.DISPLAY_TEXT, "a"))

        # Unknown escape code
        self.assertEqual(next(tokens), (1, Parser.DISPLAY_TEXT, "b"))

        # Reset
        self.assertEqual(next(tokens), (7, Parser.CHANGE_COLOURS, (7, constants.A_NORMAL, 0)))
        self.assertEqual(next(tokens), (7, Parser.DISPLAY_TEXT, "c"))

        # Bold
        self.assertEqual(next(tokens), (12, Parser.CHANGE_COLOURS, (7, constants.A_BOLD, 0)))
        self.assertEqual(next(tokens), (12, Parser.DISPLAY_TEXT, "d"))

        # Normal
        self.assertEqual(next(tokens), (17, Parser.CHANGE_COLOURS, (7, constants.A_NORMAL, 0)))
        self.assertEqual(next(tokens), (17, Parser.DISPLAY_TEXT, "e"))

        # Inverse
        self.assertEqual(next(tokens), (22, Parser.CHANGE_COLOURS, (7, constants.A_REVERSE, 0)))
        self.assertEqual(next(tokens), (22, Parser.DISPLAY_TEXT, "f"))

        # Unset inverse
        self.assertEqual(next(tokens), (27, Parser.CHANGE_COLOURS, (7, constants.A_NORMAL, 0)))
        self.assertEqual(next(tokens), (27, Parser.DISPLAY_TEXT, "g"))

        # Standard colours, using multiple parameters
        self.assertEqual(next(tokens), (33, Parser.CHANGE_COLOURS, (constants.COLOUR_RED, constants.A_NORMAL, constants.COLOUR_GREEN)))
        self.assertEqual(next(tokens), (33, Parser.DISPLAY_TEXT, "h"))

        # Final escape sequence with no visible text is returned with no text.
        self.assertEqual(next(tokens), (42, Parser.CHANGE_COLOURS, (constants.COLOUR_WHITE, constants.A_NORMAL, constants.COLOUR_BLACK)))

        with self.assertRaises(StopIteration):
            next(tokens)
Check AnsiTerminalParser basic colours work as expected.
tests/test_parsers.py