def METHOD_NAME():
    value = ANSI("\x1b[32mHe\x1b[45mllo")
    assert to_formatted_text(value) == [
        ("ansigreen", "H"),
        ("ansigreen", "e"),
        ("ansigreen bg:ansimagenta", "l"),
        ("ansigreen bg:ansimagenta", "l"),
        ("ansigreen bg:ansimagenta", "o"),
    ]
    # Bold and italic.
    value = ANSI("\x1b[1mhe\x1b[0mllo")
    assert to_formatted_text(value) == [
        ("bold", "h"),
        ("bold", "e"),
        ("", "l"),
        ("", "l"),
        ("", "o"),
    ]
    # Zero width escapes.
    value = ANSI("ab\001cd\002ef")
    assert to_formatted_text(value) == [
        ("", "a"),
        ("", "b"),
        ("[ZeroWidthEscape]", "cd"),
        ("", "e"),
        ("", "f"),
    ]
    assert isinstance(to_formatted_text(value), FormattedText)