[Python-modules-commits] [willow] 08/11: Some tests for wand/pillow backends
Christopher Stuart Hoskin
mans0954 at moszumanska.debian.org
Tue Dec 5 23:12:18 UTC 2017
This is an automated email from the git hooks/post-receive script.
mans0954 pushed a commit to tag v0.1.1
in repository willow.
commit 8ba38fe6720dc91cdfd2e246148e55ea34ca5c8b
Author: Karl Hobley <karlhobley10 at gmail.com>
Date: Wed Feb 18 22:01:44 2015 +0000
Some tests for wand/pillow backends
---
runtests.py | 2 ++
tests/images/transparent.png | Bin 0 -> 26538 bytes
tests/test_pillow.py | 30 ++++++++++++++++++++++++++++++
tests/test_wand.py | 30 ++++++++++++++++++++++++++++++
4 files changed, 62 insertions(+)
diff --git a/runtests.py b/runtests.py
index c42898f..a126c88 100644
--- a/runtests.py
+++ b/runtests.py
@@ -1,6 +1,8 @@
import unittest
from tests.test_image import *
+from tests.test_pillow import *
+from tests.test_wand import *
if __name__ == '__main__':
diff --git a/tests/images/transparent.png b/tests/images/transparent.png
new file mode 100644
index 0000000..902ea82
Binary files /dev/null and b/tests/images/transparent.png differ
diff --git a/tests/test_pillow.py b/tests/test_pillow.py
new file mode 100644
index 0000000..dece0be
--- /dev/null
+++ b/tests/test_pillow.py
@@ -0,0 +1,30 @@
+import unittest2
+
+from willow.backends import pillow as pillow_backend
+
+
+class TestPillowOperations(unittest2.TestCase):
+ def setUp(self):
+ with open('tests/images/transparent.png', 'rb') as f:
+ self.backend = pillow_backend.PillowBackend.from_file(f)
+
+ def test_get_size(self):
+ width, height = pillow_backend.get_size(self.backend)
+ self.assertEqual(width, 200)
+ self.assertEqual(height, 150)
+
+ def test_resize(self):
+ pillow_backend.resize(self.backend, 100, 75)
+ self.assertEqual(self.backend.image.size, (100, 75))
+
+ def test_resize(self):
+ pillow_backend.resize(self.backend, 100, 75)
+ self.assertEqual(self.backend.image.size, (100, 75))
+
+ def test_has_alpha(self):
+ has_alpha = pillow_backend.has_alpha(self.backend)
+ self.assertTrue(has_alpha)
+
+ def test_has_animation(self):
+ has_animation = pillow_backend.has_animation(self.backend)
+ self.assertFalse(has_animation)
diff --git a/tests/test_wand.py b/tests/test_wand.py
new file mode 100644
index 0000000..6499ce0
--- /dev/null
+++ b/tests/test_wand.py
@@ -0,0 +1,30 @@
+import unittest2
+
+from willow.backends import wand as wand_backend
+
+
+class TestWandOperations(unittest2.TestCase):
+ def setUp(self):
+ with open('tests/images/transparent.png', 'rb') as f:
+ self.backend = wand_backend.WandBackend.from_file(f)
+
+ def test_get_size(self):
+ width, height = wand_backend.get_size(self.backend)
+ self.assertEqual(width, 200)
+ self.assertEqual(height, 150)
+
+ def test_resize(self):
+ wand_backend.resize(self.backend, 100, 75)
+ self.assertEqual(self.backend.image.size, (100, 75))
+
+ def test_resize(self):
+ wand_backend.resize(self.backend, 100, 75)
+ self.assertEqual(self.backend.image.size, (100, 75))
+
+ def test_has_alpha(self):
+ has_alpha = wand_backend.has_alpha(self.backend)
+ self.assertTrue(has_alpha)
+
+ def test_has_animation(self):
+ has_animation = wand_backend.has_animation(self.backend)
+ self.assertFalse(has_animation)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/willow.git
More information about the Python-modules-commits
mailing list