def test_disk(): from mahotas.morph import disk D2 = disk(2) assert D2.shape[0] == D2.shape[1] assert D2.shape == (5,5) assert not D2[0,0] assert len(D2.shape) == 2 D3 = disk(2,3) assert np.all(D3[2] == D2) D3 = disk(4,3) assert len(D3.shape) == 3 assert D3.shape[0] == D3.shape[1] assert D3.shape[0] == D3.shape[2] # Simple regression D = disk(32, 2) assert D[32,2] @raises(ValueError) def test_negative_dim(dim): disk(3, dim) test_negative_dim(-2) test_negative_dim(-1) test_negative_dim(0)
def test_disk(): from mahotas.morph import disk D2 = disk(2) assert D2.shape[0] == D2.shape[1] assert D2.shape == (5,5) assert not D2[0,0] assert len(D2.shape) == 2 D3 = disk(2,3) assert np.all(D3[2] == D2) D3 = disk(4,3) assert len(D3.shape) == 3 assert D3.shape[0] == D3.shape[1] assert D3.shape[0] == D3.shape[2]
def test_disk(): from mahotas.morph import disk D2 = disk(2) assert D2.shape[0] == D2.shape[1] assert D2.shape == (5, 5) assert not D2[0, 0] assert len(D2.shape) == 2 D3 = disk(2, 3) assert np.all(D3[2] == D2) D3 = disk(4, 3) assert len(D3.shape) == 3 assert D3.shape[0] == D3.shape[1] assert D3.shape[0] == D3.shape[2] # Simple regression D = disk(32, 2) assert D[32, 2] # Test negative values for dim in [-2, -1, 0]: with pytest.raises(ValueError): disk(3, dim)
def test_negative_dim(dim): disk(3, dim)