def test_colorize_with_two_colors(): text = "test string <c1>with</c1> one <c2>color</c2> placeholders" assert ( colorize(text, 2, ["red", "red"]) == "test string \x1b[31mwith\x1b[39m one \x1b[31mcolor\x1b[39m placeholders" )
def test_colorize_candy_color(strip_color): text = colorize("<c1>text</c1>", 1, ["candy"]) assert strip_color(text) == "text" assert len(text) > len("text")
def test_colorize_without_color_placeholder(): text = "test string without color placeholders" assert colorize(text, 1, []) == text assert colorize(text, 1, ["red"]) == "\x1b[31m{}\x1b[39m".format(text)