diff --git a/Tests/test_file_bmp.py b/Tests/test_file_bmp.py index 6469a5bab..dd5f31fd2 100644 --- a/Tests/test_file_bmp.py +++ b/Tests/test_file_bmp.py @@ -1,6 +1,7 @@ from tester import * from PIL import Image +import io def roundtrip(im): outfile = tempfile("temp.bmp") @@ -23,3 +24,15 @@ def test_sanity(): 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") +