Added test for pathlib

This commit is contained in:
Andrew Murray 2015-08-05 21:29:24 +10:00
parent 457d39832d
commit cf4145e2c9

View File

@ -1,6 +1,7 @@
from helper import unittest, PillowTestCase, hopper
from PIL import Image
import sys
class TestImage(PillowTestCase):
@ -48,6 +49,14 @@ class TestImage(PillowTestCase):
im = io.BytesIO(b'')
self.assertRaises(IOError, lambda: Image.open(im))
@unittest.skipIf(sys.version_info < (3, 4),
"pathlib only available in Python 3.4 or later")
def test_pathlib(self):
from pathlib import Path
im = Image.open(Path("Tests/images/hopper.jpg"))
self.assertEqual(im.mode, "RGB")
self.assertEqual(im.size, (128, 128))
def test_internals(self):
im = Image.new("L", (100, 100))