def test_set_hsv(self): col = grapefruit.Color.from_hsv(30, 1, 1) col.hsv = (40, 0.5, 0.2) assert_items_almost_equal(col.hsv, (40, 0.5, 0.2)) assert_equal(col.rgb, grapefruit.hsv_to_rgb(40, 0.5, 0.2)) assert_almost_equal( col.hsl, grapefruit.rgb_to_hsl(grapefruit.hsv_to_rgb(40, 0.5, 0.2)))
def test_rgb_to_hsv(self): assert_equal((30.0, 1.0, 1.0), grapefruit.rgb_to_hsv(1, 0.5, 0)) assert_equal((1, 0.5, 0), grapefruit.hsv_to_rgb(30.0, 1.0, 1.0))
def test_set_hsv(self): col = grapefruit.Color.from_hsv(30, 1, 1) col.hsv = (40, 0.5, 0.2) assert_items_almost_equal(col.hsv, (40, 0.5, 0.2)) assert_equal(col.rgb, grapefruit.hsv_to_rgb(40, 0.5, 0.2)) assert_almost_equal(col.hsl, grapefruit.rgb_to_hsl(grapefruit.hsv_to_rgb(40, 0.5, 0.2)))