--- /dev/null
+# -*- coding: utf-8 -*-
+# snapshottest: v1 - https://goo.gl/zC4yUc
+from __future__ import unicode_literals
+
+from snapshottest import Snapshot
+from snapshottest.file import FileSnapshot
+
+
+snapshots = Snapshot()
+
+snapshots['ImageSnapshotCase::test_snapshot_fixtures hello_world'] = FileSnapshot('snap_test_image_coding/ImageSnapshotCase::test_snapshot_fixtures hello_world.png')
+import os
+from tempfile import TemporaryDirectory
from PIL import Image, ImageDraw
import unittest
+import snapshottest
+from snapshottest.file import FileSnapshot
from sirius.coding import image_encoding
self.assertEquals(image.size[0], 384)
self.assertEquals(image.size[1], 100)
+class ImageSnapshotCase(snapshottest.TestCase):
+ def test_snapshot_fixtures(self):
+ fixtures = {
+ 'hello_world': '<html><body>Hello, world!</body></html>',
+ }
+
+ for name, html in fixtures.items():
+ with TemporaryDirectory() as tmpdir:
+ data = image_encoding.html_to_png(html)
+ image = Image.open(data)
+
+ temp_file_name = os.path.join(tmpdir, '%s.png' % name)
+ image.save(temp_file_name, format='PNG')
+ self.assertMatchSnapshot(FileSnapshot(temp_file_name), name)
+
class PipeTestCase(unittest.TestCase):
def test_specific_image_rle(self):