Example #1
0
def test_get_color():
    assert get_color("red") == "\x0304"
    assert get_color("red", return_formatted=False) == "04"
Example #2
0
def test_get_random_color():
    assert get_color("random") in ["\x03" + i for i in IRC_COLOUR_DICT.values()]
    assert get_color("random", return_formatted=False) in list(IRC_COLOUR_DICT.values())
Example #3
0
def test_invalid_color():
    with pytest.raises(KeyError) as excinfo:
        get_color("cake")
    assert 'not in the list of available colours' in str(excinfo.value)