mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 09:44:31 +03:00
Test for #495, writing to bytesio
This commit is contained in:
parent
15d6cc9f57
commit
7d76ae2d91
|
@ -1,6 +1,7 @@
|
||||||
from tester import *
|
from tester import *
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
import io
|
||||||
|
|
||||||
def roundtrip(im):
|
def roundtrip(im):
|
||||||
outfile = tempfile("temp.bmp")
|
outfile = tempfile("temp.bmp")
|
||||||
|
@ -23,3 +24,15 @@ def test_sanity():
|
||||||
roundtrip(lena("RGB"))
|
roundtrip(lena("RGB"))
|
||||||
|
|
||||||
|
|
||||||
|
def test_save_to_bytes():
|
||||||
|
output = io.BytesIO()
|
||||||
|
im = lena()
|
||||||
|
im.save(output, "BMP")
|
||||||
|
|
||||||
|
output.seek(0)
|
||||||
|
reloaded = Image.open(output)
|
||||||
|
|
||||||
|
assert_equal(im.mode, reloaded.mode)
|
||||||
|
assert_equal(im.size, reloaded.size)
|
||||||
|
assert_equal(reloaded.format, "BMP")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user