code: def testAddNoise(self):
      patternMachine = PatternMachine(10000, 1000, num=1)
      pattern = patternMachine.get(0)
  
      noisy = patternMachine.addNoise(pattern, 0.0)
      self.assertEqual(len(pattern & noisy), 1000)
  
      noisy = patternMachine.addNoise(pattern, 0.5)
      self.assertTrue(400 < len(pattern & noisy) < 600)
  
      noisy = patternMachine.addNoise(pattern, 1.0)
      self.assertTrue(50 < len(pattern & noisy) < 150)
  
file_path: nupic-legacy/tests/unit/nupic/data/generators/pattern_machine_test.py
imports: import unittest
  from nupic.data.generators.pattern_machine import PatternMachine, ConsecutivePatternMachine
label_desc: Use image node_id 4 for calling the PatternMachineTest obj's underlying member method code with example usage: obj.testAddNoise() without return types