Beispiel #1
0
 def test_gaussian(self):
     test_frame = pd.DataFrame({'col1': range(5), 'col2': range(5)})
     noise = GaussianNoise(1)
     noisy_frame = noise.impact(test_frame)
     with self.assertRaises(AssertionError):
         pd_testing.assert_frame_equal(test_frame, noisy_frame)
     pass
 def test_gaussian(self):
     noise = GaussianNoise(30)
     input_image = Image.open(
         str(pkg_resources.resource_filename(__name__, 'test_image.jpeg')))
     initial_hash = hashlib.sha512()
     initial_hash.update(np.array(input_image))
     messy_image = noise.impact(input_image)
     messy_hash = hashlib.sha512()
     messy_hash.update(np.array(messy_image))
     self.assertNotEqual(initial_hash.digest(), messy_hash.digest())
     self.assertEqual(input_image.size, messy_image.size)
     self.assertEqual(input_image.mode, messy_image.mode)
     pass