    def test_asciimatics_parser(self):
        """
        Check AsciimaticsParser works as expected.
        """
        parser = AsciimaticsParser()
        parser.reset("a${1}b${2,1}c${3,2,4}de${7}", None)
        tokens = parser.parse()
        self.assertEqual(next(tokens), (0, Parser.DISPLAY_TEXT, "a"))
        self.assertEqual(next(tokens), (1, Parser.CHANGE_COLOURS, (1, 0, None)))
        self.assertEqual(next(tokens), (1, Parser.DISPLAY_TEXT, "b"))
        self.assertEqual(next(tokens), (6, Parser.CHANGE_COLOURS, (2, 1, None)))
        self.assertEqual(next(tokens), (6, Parser.DISPLAY_TEXT, "c"))
        self.assertEqual(next(tokens), (13, Parser.CHANGE_COLOURS, (3, 2, 4)))
        self.assertEqual(next(tokens), (13, Parser.DISPLAY_TEXT, "d"))
        self.assertEqual(next(tokens), (22, Parser.DISPLAY_TEXT, "e"))
        self.assertEqual(next(tokens), (23, Parser.CHANGE_COLOURS, (7, 0, None)))
        with self.assertRaises(StopIteration):
            next(tokens)
Check AsciimaticsParser works as expected.
tests/test_parsers.py