Fix tostring()/tobytes() warning and reinstate test

This commit is contained in:
hugovk 2014-05-12 14:30:03 +03:00
parent bcb8534dcf
commit c37aa0a9ca
2 changed files with 7 additions and 13 deletions

View File

@ -144,7 +144,7 @@ def _save(im, fp, filename):
if bits == 1:
# FIXME: the hex encoder doesn't support packed 1-bit
# images; do things the hard way...
data = im.tostring("raw", "1")
data = im.tobytes("raw", "1")
im = Image.new("L", (len(data), 1), None)
im.putdata(data)
ImageFile._save(im, op, [("hex", (0,0)+im.size, 0, im.mode)])

View File

@ -15,18 +15,12 @@ def helper_save_as_pdf(mode):
assert_greater(os.path.getsize(outfile), 0)
# FIXME: 1-mode test "fails" because it produces a warning.
# https://travis-ci.org/hugovk/Pillow/builds/24916085
# /home/travis/build/hugovk/Pillow/PIL/PdfImagePlugin.py:147:
# DeprecationWarning: tostring() is deprecated. Please call tobytes() instead.
# data = im.tostring("raw", "1")
#
# def test_monochrome():
# # Arrange
# mode = "1"
#
# # Act / Assert
# helper_save_as_pdf(mode)
def test_monochrome():
# Arrange
mode = "1"
# Act / Assert
helper_save_as_pdf(mode)
def test_greyscale():