def test_gridmask_transform(img, d_range, rotate, ratio, expected): np.random.seed(42) random.seed(42) dc = slc.DataContainer((img,), "I") trf = slc.Stream([slt.GridMask(d_range=d_range, rotate=rotate, ratio=ratio, p=1)]) dc_res = trf(dc, return_torch=False) print(dc_res.data[0]) assert np.array_equal(expected, dc_res.data[0])
def test_gridmask_rotate_raises_error_when_wrong_tuple(rotate): with pytest.raises(TypeError): slt.GridMask(rotate=rotate, p=1)
def test_gridmask_d_range_raises_error_when_wrong(d_range): with pytest.raises(ValueError): slt.GridMask(d_range=d_range, p=1)