def test_singleton_dim():
 image = np.random.rand(1, 20)
 noisy = random_noise(image, mode='salt', amount=0.1, seed=42)
 assert (np.sum((noisy == 1)) == 2)

def test_singleton_dim ( ) : image = np . random . rand ( 1 , 20 ) noisy = random_noise ( image , mode = 'salt' , amount = 0.1 , seed = 42 ) assert ( np . sum ( ( noisy == 1 ) ) == 2 )
ensure images where size of a given dimension is 1 work correctly .