class_docstr: Test DataTransforms for images
class_docstr_tok: ["Test","DataTransforms","for","images"]
code: def test_salt_pepper_noise(self):
      # check salt and pepper noise
      dt = DataTransforms(self.d)
      np.random.seed(0)
      prob = 0.05
      random_noise = self.d
      noise = np.random.random(size=self.d.shape)
      random_noise[noise < (prob / 2)] = 0
      random_noise[noise > (1 - prob / 2)] = 255
      np.random.seed(0)
      check_random_noise = dt.salt_pepper_noise(
          prob, salt=255, pepper=0
      )
      assert np.allclose(random_noise, check_random_noise)
  
imports: import os
  import unittest
  import numpy
  import pytest
  import scipy.ndimage
  import deepchem
  from deepchem.trans.transformers import DataTransforms
label_desc: Use image node_id 11 for calling the TestDataTransforms obj's underlying member method code with example usage: obj.test_salt_pepper_noise() without return types