Permalink
Browse files

Change method from split to extract. Added a runtests script to easil…

…y run the tests.
  • Loading branch information...
1 parent 325e6b1 commit 94e3f503d24a531985fa61a5746d1044fb80965f @sebleier committed Dec 19, 2011
Showing with 15 additions and 10 deletions.
  1. +2 −2 README.rst
  2. +5 −0 runtests
  3. +1 −1 setup.py
  4. +1 −1 stega/__init__.py
  5. +6 −6 tests/__init__.py
View
@@ -16,9 +16,9 @@ Usage::
s = Stega(image)
s.add_message(msg)
- im, message = s.split()
+ im, message = s.extract()
assert message == msg
Run tests::
- $ python tests/__init__.py
+ $ ./runtests
View
@@ -0,0 +1,5 @@
+#!/usr/bin/env python
+
+import unittest
+from tests import *
+unittest.main()
View
@@ -7,6 +7,6 @@
author_email = "sebleier@gmail.com",
version = "0.0.1",
packages = ["stega"],
- description = "A steganography tool for lossless message hiding",
+ description = "A steganography tool for lossless message hiding in images.",
install_requires=['PIL'],
)
View
@@ -139,7 +139,7 @@ def save(self, name):
def close(self):
self.img.close()
- def split(self):
+ def extract(self):
W = BitMessage()
n = 0
for b in self.B:
View
@@ -120,16 +120,16 @@ def test_stega(self):
Test steganography by saving image to disk, then reopening to
extract message
"
-
+ msg = "What hath God wrought."
s = Stega(self.image)
- s.add_message("sean")
+ s.add_message(msg)
s.save("test_image.png")
s.close()
saved_image = Image.open('test_image.png')
s = Stega(saved_image)
- im, message = s.split()
- self.assertEqual(message, "sean")
+ im, message = s.extract()
+ self.assertEqual(message, msg)
self.assertEqual(im.tostring(), self.original.tostring())
"""
@@ -138,10 +138,10 @@ def test_stega(self):
Test stega with in memory image representation, i.e. not saving
to disk and reopening later.
"""
- msg = "What hath God wrought. "
+ msg = "What hath God wrought."
s = Stega(self.image)
s.add_message(msg)
- im, message = s.split()
+ im, message = s.extract()
self.assertEqual(message, msg)
self.assertEqual(im.tostring(), self.original.tostring())

0 comments on commit 94e3f50

Please sign in to comment.