예제 #1
0
 def test_invalid(self, colorint):
     with pytest.raises(ValueError):
         Color.from_int(colorint)
예제 #2
0
 def test_alphacolor_comparison(self, func):
     color = Color.from_int(0xefab3)
     alphacolor = AlphaColor.from_name("red")
     assert getattr(color, func)(alphacolor) == NotImplemented
예제 #3
0
 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
예제 #4
0
 def test_invalid_comparison(self, func, arg):
     color = Color.from_int(0xefab3)
     assert getattr(color, func)(arg) == NotImplemented
예제 #5
0
 def test_eq(self):
     color_a = Color.from_int(0xefab3)
     color_b = Color.from_int(0xefab3)
     assert color_a == color_b
예제 #6
0
 def test_gt(self):
     color_a = Color.from_int(0xffab3)
     color_b = Color.from_int(0xefab3)
     assert color_a > color_b
예제 #7
0
def test_hex():
    color = Color.from_int(0xabcdef)
    assert hex(color) == "0xabcdef"
예제 #8
0
def test_repr():
    color = Color.from_int(0xabcdef)
    assert repr(color) == "<Color(0xabcdef)>"
예제 #9
0
def test_str():
    color = Color.from_int(0xabcdef)
    assert str(color) == "abcdef"
예제 #10
0
 def test_ne(self):
     color_a = Color.from_int(0xefab3)
     color_b = Color.from_int(0xffab3)
     assert color_a != color_b