def test_true_min_boundary(): assert isinstance(pixy.TrueColour(0, 0, 0), pixy.TrueColour) with pytest.raises(ValueError): pixy.TrueColour(-1, 0, 0) with pytest.raises(ValueError): pixy.TrueColour(0, -1, 0) with pytest.raises(ValueError): pixy.TrueColour(0, 0, -1)
def test_true_max_boundary(): assert isinstance(pixy.TrueColour(255, 255, 255), pixy.TrueColour) with pytest.raises(ValueError): pixy.TrueColour(256, 255, 255) with pytest.raises(ValueError): pixy.TrueColour(255, 256, 255) with pytest.raises(ValueError): pixy.TrueColour(255, 255, 256)
def test_true_background_named(): colour = pixy.TrueColour(10, 20, 30, background=True) assert colour.code == "\x1b[48;2;10;20;30m"
def test_true_foreground(): colour = pixy.TrueColour(10, 20, 30) assert colour.code == "\x1b[38;2;10;20;30m"
def test_true_colour_add(): e = pixy.TrueColour(10, 10, 10) + pixy.EscapeSequence(3, 4) assert isinstance(e, pixy.EscapeSequence) assert e == pixy.EscapeSequence(38, 2, 10, 10, 10, 3, 4)