diff --git a/PIL/ImageFont.py b/PIL/ImageFont.py index 9366937dd..18d09b871 100644 --- a/PIL/ImageFont.py +++ b/PIL/ImageFont.py @@ -396,7 +396,7 @@ w7IkEbzhVQAAAABJRU5ErkJggg== if __name__ == "__main__": # create font data chunk for embedding import base64, os, sys - font = "../Images/courB08" + font = "../Tests/images/courB08" print(" f._load_pilfont_data(") print(" # %s" % os.path.basename(font)) print(" BytesIO(base64.decodestring(b'''") diff --git a/Tests/helper.py b/Tests/helper.py index c203e67c2..aacbfc009 100644 --- a/Tests/helper.py +++ b/Tests/helper.py @@ -233,7 +233,7 @@ def lena(mode="RGB", cache={}): # im = cache.get(mode) if im is None: if mode == "RGB": - im = Image.open("Images/lena.ppm") + im = Image.open("Tests/images/lena.ppm") elif mode == "F": im = lena("L").convert(mode) elif mode[:4] == "I;16": diff --git a/Tests/test_file_fli.py b/Tests/test_file_fli.py index 787365c14..a98a80b78 100644 --- a/Tests/test_file_fli.py +++ b/Tests/test_file_fli.py @@ -3,7 +3,7 @@ from helper import unittest, PillowTestCase, tearDownModule from PIL import Image # sample ppm stream -file = "Images/lena.fli" +file = "Tests/images/lena.fli" data = open(file, "rb").read() diff --git a/Tests/test_file_gif.py b/Tests/test_file_gif.py index 3aefbe9b3..01ac1d95c 100644 --- a/Tests/test_file_gif.py +++ b/Tests/test_file_gif.py @@ -5,7 +5,7 @@ from PIL import Image codecs = dir(Image.core) # sample gif stream -file = "Images/lena.gif" +file = "Tests/images/lena.gif" with open(file, "rb") as f: data = f.read() @@ -45,7 +45,7 @@ class TestFileGif(PillowTestCase): def test_roundtrip2(self): # see https://github.com/python-pillow/Pillow/issues/403 out = self.tempfile('temp.gif') - im = Image.open('Images/lena.gif') + im = Image.open('Tests/images/lena.gif') im2 = im.copy() im2.save(out) reread = Image.open(out) @@ -55,7 +55,7 @@ class TestFileGif(PillowTestCase): def test_palette_handling(self): # see https://github.com/python-pillow/Pillow/issues/513 - im = Image.open('Images/lena.gif') + im = Image.open('Tests/images/lena.gif') im = im.convert('RGB') im = im.resize((100, 100), Image.ANTIALIAS) diff --git a/Tests/test_file_icns.py b/Tests/test_file_icns.py index c307ec844..f19eb16b7 100644 --- a/Tests/test_file_icns.py +++ b/Tests/test_file_icns.py @@ -3,7 +3,7 @@ from helper import unittest, PillowTestCase, tearDownModule from PIL import Image # sample icon file -file = "Images/pillow.icns" +file = "Tests/images/pillow.icns" data = open(file, "rb").read() enable_jpeg2k = hasattr(Image.core, 'jp2klib_version') diff --git a/Tests/test_file_ico.py b/Tests/test_file_ico.py index 5bad94a53..165d10225 100644 --- a/Tests/test_file_ico.py +++ b/Tests/test_file_ico.py @@ -3,7 +3,7 @@ from helper import unittest, PillowTestCase, tearDownModule from PIL import Image # sample ppm stream -file = "Images/lena.ico" +file = "Tests/images/lena.ico" data = open(file, "rb").read() diff --git a/Tests/test_file_jpeg.py b/Tests/test_file_jpeg.py index c21910962..158299c36 100644 --- a/Tests/test_file_jpeg.py +++ b/Tests/test_file_jpeg.py @@ -8,7 +8,7 @@ from PIL import ImageFile codecs = dir(Image.core) -test_file = "Images/lena.jpg" +test_file = "Tests/images/lena.jpg" class TestFileJpeg(PillowTestCase): @@ -215,7 +215,7 @@ class TestFileJpeg(PillowTestCase): self.assertEqual(info[305], 'Adobe Photoshop CS Macintosh') def test_quality_keep(self): - im = Image.open("Images/lena.jpg") + im = Image.open("Tests/images/lena.jpg") f = self.tempfile('temp.jpg') im.save(f, quality='keep') diff --git a/Tests/test_file_png.py b/Tests/test_file_png.py index 6da61be6b..145eff327 100644 --- a/Tests/test_file_png.py +++ b/Tests/test_file_png.py @@ -10,7 +10,7 @@ codecs = dir(Image.core) # sample png stream -file = "Images/lena.png" +file = "Tests/images/lena.png" data = open(file, "rb").read() # stuff to create inline PNG images @@ -204,10 +204,10 @@ class TestFilePng(PillowTestCase): def test_load_verify(self): # Check open/load/verify exception (@PIL150) - im = Image.open("Images/lena.png") + im = Image.open("Tests/images/lena.png") im.verify() - im = Image.open("Images/lena.png") + im = Image.open("Tests/images/lena.png") im.load() self.assertRaises(RuntimeError, lambda: im.verify()) diff --git a/Tests/test_file_ppm.py b/Tests/test_file_ppm.py index 9d5dd806a..d9e4e0674 100644 --- a/Tests/test_file_ppm.py +++ b/Tests/test_file_ppm.py @@ -3,7 +3,7 @@ from helper import unittest, PillowTestCase, tearDownModule from PIL import Image # sample ppm stream -file = "Images/lena.ppm" +file = "Tests/images/lena.ppm" data = open(file, "rb").read() diff --git a/Tests/test_file_psd.py b/Tests/test_file_psd.py index e7f86fd98..007646901 100644 --- a/Tests/test_file_psd.py +++ b/Tests/test_file_psd.py @@ -3,7 +3,7 @@ from helper import unittest, PillowTestCase, tearDownModule from PIL import Image # sample ppm stream -file = "Images/lena.psd" +file = "Tests/images/lena.psd" data = open(file, "rb").read() diff --git a/Tests/test_file_tar.py b/Tests/test_file_tar.py index 36a625add..7e36f35fc 100644 --- a/Tests/test_file_tar.py +++ b/Tests/test_file_tar.py @@ -5,7 +5,7 @@ from PIL import Image, TarIO codecs = dir(Image.core) # sample ppm stream -tarfile = "Images/lena.tar" +tarfile = "Tests/images/lena.tar" class TestFileTar(PillowTestCase): diff --git a/Tests/test_file_webp.py b/Tests/test_file_webp.py index ea1c2e19f..1eeea57d3 100644 --- a/Tests/test_file_webp.py +++ b/Tests/test_file_webp.py @@ -23,7 +23,7 @@ class TestFileWebp(PillowTestCase): def test_read_rgb(self): - file_path = "Images/lena.webp" + file_path = "Tests/images/lena.webp" image = Image.open(file_path) self.assertEqual(image.mode, "RGB") @@ -33,7 +33,7 @@ class TestFileWebp(PillowTestCase): image.getdata() # generated with: - # dwebp -ppm ../../Images/lena.webp -o lena_webp_bits.ppm + # dwebp -ppm ../../Tests/images/lena.webp -o lena_webp_bits.ppm target = Image.open('Tests/images/lena_webp_bits.ppm') self.assert_image_similar(image, target, 20.0) diff --git a/Tests/test_file_webp_alpha.py b/Tests/test_file_webp_alpha.py index c9787c60e..0df3143bb 100644 --- a/Tests/test_file_webp_alpha.py +++ b/Tests/test_file_webp_alpha.py @@ -22,7 +22,7 @@ class TestFileWebpAlpha(PillowTestCase): def test_read_rgba(self): # Generated with `cwebp transparent.png -o transparent.webp` - file_path = "Images/transparent.webp" + file_path = "Tests/images/transparent.webp" image = Image.open(file_path) self.assertEqual(image.mode, "RGBA") @@ -33,7 +33,7 @@ class TestFileWebpAlpha(PillowTestCase): image.tobytes() - target = Image.open('Images/transparent.png') + target = Image.open('Tests/images/transparent.png') self.assert_image_similar(image, target, 20.0) def test_write_lossless_rgb(self): diff --git a/Tests/test_file_webp_metadata.py b/Tests/test_file_webp_metadata.py index 93021ac07..2470f4c49 100644 --- a/Tests/test_file_webp_metadata.py +++ b/Tests/test_file_webp_metadata.py @@ -15,7 +15,7 @@ class TestFileWebpMetadata(PillowTestCase): def test_read_exif_metadata(self): - file_path = "Images/flower.webp" + file_path = "Tests/images/flower.webp" image = Image.open(file_path) self.assertEqual(image.format, "WEBP") @@ -54,7 +54,7 @@ class TestFileWebpMetadata(PillowTestCase): def test_read_icc_profile(self): - file_path = "Images/flower2.webp" + file_path = "Tests/images/flower2.webp" image = Image.open(file_path) self.assertEqual(image.format, "WEBP") diff --git a/Tests/test_file_xpm.py b/Tests/test_file_xpm.py index 0c765da8e..e6e750298 100644 --- a/Tests/test_file_xpm.py +++ b/Tests/test_file_xpm.py @@ -3,7 +3,7 @@ from helper import unittest, PillowTestCase, tearDownModule from PIL import Image # sample ppm stream -file = "Images/lena.xpm" +file = "Tests/images/lena.xpm" data = open(file, "rb").read() diff --git a/Tests/test_font_bdf.py b/Tests/test_font_bdf.py index 9a8f19d03..ce5a371e0 100644 --- a/Tests/test_font_bdf.py +++ b/Tests/test_font_bdf.py @@ -2,7 +2,7 @@ from helper import unittest, PillowTestCase, tearDownModule from PIL import FontFile, BdfFontFile -filename = "Images/courB08.bdf" +filename = "Tests/images/courB08.bdf" class TestFontBdf(PillowTestCase): diff --git a/Tests/test_image_convert.py b/Tests/test_image_convert.py index 946dddc11..1415bae3a 100644 --- a/Tests/test_image_convert.py +++ b/Tests/test_image_convert.py @@ -36,7 +36,7 @@ class TestImageConvert(PillowTestCase): self.assertEqual(orig, converted) def test_8bit(self): - im = Image.open('Images/lena.jpg') + im = Image.open('Tests/images/lena.jpg') self._test_float_conversion(im.convert('L')) def test_16bit(self): diff --git a/Tests/test_image_draft.py b/Tests/test_image_draft.py index e970c9794..252e60376 100644 --- a/Tests/test_image_draft.py +++ b/Tests/test_image_draft.py @@ -3,7 +3,7 @@ from helper import unittest, PillowTestCase, tearDownModule, fromstring, tostrin from PIL import Image codecs = dir(Image.core) -filename = "Images/lena.jpg" +filename = "Tests/images/lena.jpg" data = tostring(Image.open(filename).resize((512, 512)), "JPEG") diff --git a/Tests/test_image_load.py b/Tests/test_image_load.py index cf23a0101..14cb76fdb 100644 --- a/Tests/test_image_load.py +++ b/Tests/test_image_load.py @@ -16,14 +16,14 @@ class TestImageLoad(PillowTestCase): self.assertEqual(pix[0, 0], (223, 162, 133)) def test_close(self): - im = Image.open("Images/lena.gif") + im = Image.open("Tests/images/lena.gif") im.close() self.assertRaises(ValueError, lambda: im.load()) self.assertRaises(ValueError, lambda: im.getpixel((0, 0))) def test_contextmanager(self): fn = None - with Image.open("Images/lena.gif") as im: + with Image.open("Tests/images/lena.gif") as im: fn = im.fp.fileno() os.fstat(fn) diff --git a/Tests/test_imageops_usm.py b/Tests/test_imageops_usm.py index 2f81eebce..486b201ab 100644 --- a/Tests/test_imageops_usm.py +++ b/Tests/test_imageops_usm.py @@ -4,7 +4,7 @@ from PIL import Image from PIL import ImageOps from PIL import ImageFilter -im = Image.open("Images/lena.ppm") +im = Image.open("Tests/images/lena.ppm") class TestImageOpsUsm(PillowTestCase): diff --git a/Tests/test_locale.py b/Tests/test_locale.py index 7ef63634b..0465fb207 100644 --- a/Tests/test_locale.py +++ b/Tests/test_locale.py @@ -19,7 +19,7 @@ import locale # one of string.whitespace is not freely convertable into ascii. -path = "Images/lena.jpg" +path = "Tests/images/lena.jpg" class TestLocale(PillowTestCase): diff --git a/Tests/test_pickle.py b/Tests/test_pickle.py index 5f3ae6f51..304baf964 100644 --- a/Tests/test_pickle.py +++ b/Tests/test_pickle.py @@ -6,7 +6,7 @@ from PIL import Image class TestPickle(PillowTestCase): def helper_pickle_file(self, pickle, protocol=0): - im = Image.open('Images/lena.jpg') + im = Image.open('Tests/images/lena.jpg') filename = self.tempfile('temp.pkl') # Act @@ -19,7 +19,7 @@ class TestPickle(PillowTestCase): self.assertEqual(im, loaded_im) def helper_pickle_string( - self, pickle, protocol=0, file='Images/lena.jpg'): + self, pickle, protocol=0, file='Tests/images/lena.jpg'): im = Image.open(file) # Act diff --git a/Tests/tester.py b/Tests/tester.py index 4476aced1..866009251 100644 --- a/Tests/tester.py +++ b/Tests/tester.py @@ -215,7 +215,7 @@ def lena(mode="RGB", cache={}): im = cache.get(mode) if im is None: if mode == "RGB": - im = Image.open("Images/lena.ppm") + im = Image.open("Tests/images/lena.ppm") elif mode == "F": im = lena("L").convert(mode) elif mode[:4] == "I;16": diff --git a/Tests/threaded_save.py b/Tests/threaded_save.py index 471e24815..12fcff2cf 100644 --- a/Tests/threaded_save.py +++ b/Tests/threaded_save.py @@ -9,7 +9,7 @@ try: except: format = "PNG" -im = Image.open("Images/lena.ppm") +im = Image.open("Tests/images/lena.ppm") im.load() queue = queue.Queue() diff --git a/selftest.py b/selftest.py index 248cb3937..29af34ad2 100644 --- a/selftest.py +++ b/selftest.py @@ -49,13 +49,13 @@ def testimage(): Or open existing files: - >>> im = Image.open(os.path.join(ROOT, "Images/lena.gif")) + >>> im = Image.open(os.path.join(ROOT, "Tests/images/lena.gif")) >>> _info(im) ('GIF', 'P', (128, 128)) - >>> _info(Image.open(os.path.join(ROOT, "Images/lena.ppm"))) + >>> _info(Image.open(os.path.join(ROOT, "Tests/images/lena.ppm"))) ('PPM', 'RGB', (128, 128)) >>> try: - ... _info(Image.open(os.path.join(ROOT, "Images/lena.jpg"))) + ... _info(Image.open(os.path.join(ROOT, "Tests/images/lena.jpg"))) ... except IOError as v: ... print(v) ('JPEG', 'RGB', (128, 128)) @@ -63,7 +63,7 @@ def testimage(): PIL doesn't actually load the image data until it's needed, or you call the "load" method: - >>> im = Image.open(os.path.join(ROOT, "Images/lena.ppm")) + >>> im = Image.open(os.path.join(ROOT, "Tests/images/lena.ppm")) >>> print(im.im) # internal image attribute None >>> a = im.load() @@ -73,7 +73,7 @@ def testimage(): You can apply many different operations on images. Most operations return a new image: - >>> im = Image.open(os.path.join(ROOT, "Images/lena.ppm")) + >>> im = Image.open(os.path.join(ROOT, "Tests/images/lena.ppm")) >>> _info(im.convert("L")) (None, 'L', (128, 128)) >>> _info(im.copy())