def test_darken_operation_respects_maximum_grayscale(dummy_image: Image): p = GrayPixel(100) dummy_image.set_pixel(1, 1, p) darken_img = dummy_image.darken(200) assert not any(val.value > 0 for row in darken_img.values for val in row)
def test_cannot_set_pixel_at_out_of_bounds_coordinates(dummy_image: Image, x: int, y: int): p = GrayPixel(1) with pytest.raises(ValidationError): dummy_image.set_pixel(x=x, y=y, pixel=p)
def test_lighten_operation_respects_maximum_grayscale(dummy_image: Image): p = GrayPixel(100) dummy_image.set_pixel(1, 1, p) ligthen_img = dummy_image.lighten(200) assert not any(val.value > 255 for row in ligthen_img.values for val in row)
def test_can_set_pixel_at_valid_coordinate(dummy_image: Image): p = GrayPixel(1) dummy_image.set_pixel(x=1, y=1, pixel=p)