From cf4145e2c9c838336f84dcf5e67ced3b2e4cfc22 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Wed, 5 Aug 2015 21:29:24 +1000 Subject: [PATCH] Added test for pathlib --- Tests/test_image.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Tests/test_image.py b/Tests/test_image.py index bd5fd3522..fa7f8ec06 100644 --- a/Tests/test_image.py +++ b/Tests/test_image.py @@ -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))