Beispiel #1
0
 def color_style_names(self):
     """Returns an iterable of all available style names."""
     return ansi_color_style_names()
Beispiel #2
0
 def color_style_names(self):
     """Returns an iterable of all available style names."""
     return ansi_color_style_names()
Beispiel #3
0
        ("48;5;235;38;5;139;3", ("BACKGROUND_BLACK", "ITALIC_WHITE")),
        ("38;5;111;4", ("UNDERLINE_WHITE", )),
        ("1;48;5;124", ("BACKGROUND_RED", "BOLD_WHITE")),
        ("5;48;5;124", ("BACKGROUND_RED", "SLOWBLINK_WHITE")),
        ("1;5;38;5;145;48;5;124", ("BOLD_SLOWBLINK_WHITE", "BACKGROUND_RED")),
    ],
)
def test_ansi_color_escape_code_to_name(inp, exp):
    obs = ansi_color_escape_code_to_name(inp, "default", reversed_style=RS)
    assert obs == exp


@pytest.mark.parametrize(
    "color, style",
    [(color, style) for color in DEFAULT_CMAP.keys()
     for style in ansi_color_style_names()],
)
def test_ansi_color_name_to_escape_code_for_all_styles(color, style):
    escape_code = ansi_color_name_to_escape_code(color, style)
    assert len(escape_code) > 0


@pytest.mark.parametrize(
    "style_name",
    [
        ("default"),
        ("monokai"),  # defined in `ansi_colors.py`
        ("rainbow_dash"),  # not in `ansi_colors.py`, but in pygments
        ("foobar"),  # invalid, should not fail
    ],
)