예제 #1
0
def test_mask_image_no_copy():
    """ Test that mask_image can work in-place """
    mask = np.random.randint(0, 1, size=(64, 64), dtype=bool)
    image = np.random.random((64, 64))
    masked = mask_image(image, mask, copy=False)

    assert image is masked
예제 #2
0
    def test_no_copy(self):
        """ Test that mask_image can work in-place """
        mask = np.random.randint(0, 1, size=(64, 64), dtype=np.bool)
        image = np.random.random((64, 64))
        masked = mask_image(image, mask, copy=False)

        self.assertIs(image, masked)
예제 #3
0
def test_mask_image_trivial():
    mask = np.ones((64, 64), dtype=bool)
    image = np.random.random((64, 64))
    masked = mask_image(image, mask)

    assert np.allclose(image, masked)
예제 #4
0
    def test_trivial(self):
        mask = np.ones((64, 64), dtype=np.bool)
        image = np.random.random((64, 64))
        masked = mask_image(image, mask)

        self.assertTrue(np.allclose(image, masked))