def test_not_valid_color_tuple_wrong_range(self, setting_info): with pytest.raises(ValueError): rgbcolor.process_value(setting_info, [-1, 256, 1337])
def test_not_valid_color_ints_wrong_type(self, setting_info): with pytest.raises(ValueError): rgbcolor.process_value(setting_info, ["ff", "18", "00"])
def test_not_valid_color_tuple_2_channels(self, setting_info): with pytest.raises(ValueError): rgbcolor.process_value(setting_info, [0xFF, 0x18])
def test_valid_color_tuple(self, setting_info, color): bytes_ = rgbcolor.process_value(setting_info, color) assert bytes_ == [0xFF, 0x18, 0x00]
def test_not_valid_color_string(self, setting_info): with pytest.raises(ValueError): rgbcolor.process_value(setting_info, "hello")
def test_named_colors(self, setting_info, color, result): bytes_ = rgbcolor.process_value(setting_info, color) assert bytes_ == result
def test_valid_color_hex_string(self, setting_info, color): bytes_ = rgbcolor.process_value(setting_info, color) assert bytes_ == [0xFF, 0x22, 0x00]