Added steganalysis.statistics unit test

This commit is contained in:
AdrienCos 2019-06-06 22:36:06 -04:00
parent b054fc7a0c
commit a060757f76
No known key found for this signature in database
GPG key ID: 97AD9AEBCA16D08D
2 changed files with 12 additions and 1 deletions

View file

@ -0,0 +1 @@
([58, 56, 54, 57, 60, 59, 62, 61, 63, 65, 64, 66, 67, 254, 68, 69, 255, 70, 253, 71, 72, 74, 252, 73, 251, 250, 75, 249, 76, 77], [(224, 4327), (221, 4138), (223, 4057), (222, 3987), (225, 3713), (220, 3554), (209, 3516), (207, 3476), (208, 3424), (219, 3360)])

View file

@ -32,7 +32,7 @@ import unittest
from unittest.mock import patch from unittest.mock import patch
from stegano import lsb from stegano import lsb
from stegano.steganalysis import parity from stegano.steganalysis import parity, statistics
from PIL import Image, ImageChops from PIL import Image, ImageChops
@ -59,6 +59,16 @@ class TestSteganalysis(unittest.TestCase):
diff = ImageChops.difference(target, analysis).getbbox() diff = ImageChops.difference(target, analysis).getbbox()
self.assertTrue(diff is None) self.assertTrue(diff is None)
def test_statistics(self):
""" Test stegano.steganalysis.statistics
"""
image = Image.open("./tests/sample-files/Lenna.png")
stats = str(statistics.steganalyse(image)) + '\n'
file = open("./tests/expected-results/statistics")
target = file.read()
file.close()
self.assertEqual(stats, target)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()