示例#1
0
    def test_crop_center(self, image, crop_shape, center):
        image_ref = np.array([[1, 1, 1, 1], [0, 1, 0, 1]])
        result = crop_image(image, crop_shape, center)

        assert result.shape == crop_shape
        if crop_shape == (2, 4) and center == (6, 3):
            assert (result == image_ref).all()
示例#2
0
    def test_crop_shape(self, image, crop_shape):
        image_ref = np.array([[0, 1, 1, 1], [1, 0, 1, 1]])

        result = crop_image(image, crop_shape)

        assert result.shape == crop_shape
        if crop_shape == (2, 4):
            assert (result == image_ref).all()
示例#3
0
 def test_crop_outside(self, image, center):
     with pytest.raises(ValueError):
         print(crop_image(image, image.shape, center))
示例#4
0
    def test_shape_invalid(self, image, crop_shape_invalid):
        with pytest.raises(ValueError):

            crop_image(image, crop_shape_invalid)