From 63a32a9c5b13d7cbe067831c1196b3929840a907 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Wed, 1 Jul 2015 15:47:47 +1000 Subject: [PATCH] Added test for GimpPaletteFile --- MANIFEST.in | 1 + Tests/images/test.gpl | 4 ++++ Tests/test_file_gimppalette.py | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 Tests/images/test.gpl create mode 100644 Tests/test_file_gimppalette.py diff --git a/MANIFEST.in b/MANIFEST.in index ad5bc3bed..70ca05b01 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -29,6 +29,7 @@ recursive-include Tests *.eps recursive-include Tests *.fli recursive-include Tests *.ggr recursive-include Tests *.gif +recursive-include Tests *.gpl recursive-include Tests *.gnuplot recursive-include Tests *.html recursive-include Tests *.icc diff --git a/Tests/images/test.gpl b/Tests/images/test.gpl new file mode 100644 index 000000000..7436a3099 --- /dev/null +++ b/Tests/images/test.gpl @@ -0,0 +1,4 @@ +GIMP Palette +Name: Test +Columns: 0 +# diff --git a/Tests/test_file_gimppalette.py b/Tests/test_file_gimppalette.py new file mode 100644 index 000000000..bb18e8026 --- /dev/null +++ b/Tests/test_file_gimppalette.py @@ -0,0 +1,19 @@ +from helper import unittest, PillowTestCase + +from PIL.GimpPaletteFile import GimpPaletteFile + + +class TestImage(PillowTestCase): + + def test_sanity(self): + with open('Tests/images/test.gpl', 'rb') as fp: + GimpPaletteFile(fp) + + with open('Tests/images/hopper.jpg', 'rb') as fp: + self.assertRaises(SyntaxError, lambda: GimpPaletteFile(fp)) + + +if __name__ == '__main__': + unittest.main() + +# End of file