def test_invalid(self, colorint): with pytest.raises(ValueError): Color.from_int(colorint)
def test_alphacolor_comparison(self, func): color = Color.from_int(0xefab3) alphacolor = AlphaColor.from_name("red") assert getattr(color, func)(alphacolor) == NotImplemented
def test_valid(self, colorint, rgb): color = Color.from_int(colorint) rounded_comps = [round(comp, 4) for comp in color.rgb] assert rounded_comps == rgb
def test_invalid_comparison(self, func, arg): color = Color.from_int(0xefab3) assert getattr(color, func)(arg) == NotImplemented
def test_eq(self): color_a = Color.from_int(0xefab3) color_b = Color.from_int(0xefab3) assert color_a == color_b
def test_gt(self): color_a = Color.from_int(0xffab3) color_b = Color.from_int(0xefab3) assert color_a > color_b
def test_hex(): color = Color.from_int(0xabcdef) assert hex(color) == "0xabcdef"
def test_repr(): color = Color.from_int(0xabcdef) assert repr(color) == "<Color(0xabcdef)>"
def test_str(): color = Color.from_int(0xabcdef) assert str(color) == "abcdef"
def test_ne(self): color_a = Color.from_int(0xefab3) color_b = Color.from_int(0xffab3) assert color_a != color_b