Add test for compression keyword
@@ -392,6 +392,20 @@ class Test(unittest.TestCase):
info = r.read()[3]
png.Writer(**info)
+ def test_write_compression(self):
+ """Test that compression keyword works."""
+
+ w = png.Writer(2, 2, compression=1)
+ o = BytesIO()
+ w.write(o, [[1, 4], [16, 224]])
+ r = png.Reader(bytes=o.getvalue())
+ x, y, rows, info = r.asDirect()
+ rows = list(rows)
+ self.assertEqual(len(rows), 2)
+ self.assertEqual(
+ [list(row) for row in rows],
+ [[1, 4], [16, 224]])
+
def test_write_packed(self):
"""Test iterator for row when using write_packed.
