mirror of
https://github.com/cedricbonhomme/Stegano.git
synced 2025-05-12 17:18:30 +02:00
Added steganalysis.statistics unit test
This commit is contained in:
parent
b054fc7a0c
commit
a060757f76
2 changed files with 12 additions and 1 deletions
1
tests/expected-results/statistics
Normal file
1
tests/expected-results/statistics
Normal 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)])
|
|
@ -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()
|
||||||
|
|
Loading…
Add table
Reference in a new issue