diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2010-05-21 20:30:58 +0200 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2010-05-21 20:30:58 +0200 |
commit | f33e97cce19571f9470787c56541800eeb87f6e6 (patch) | |
tree | 55c015f6b5799fca476b977d92592cb2c519fe57 | |
parent | 550dc9ae815cc012a9c8cd755ddb58c496a3a13c (diff) | |
download | pyexiv2-f33e97cce19571f9470787c56541800eeb87f6e6.tar.gz |
Unit tests: use a JPEG image instead of a PNG image.
It looks like exiv2 (silently) fails to set the comment on an empty PNG image.
Needs further investigation.
-rw-r--r-- | test/metadata.py | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/test/metadata.py b/test/metadata.py index 86935ce..a501c8c 100644 --- a/test/metadata.py +++ b/test/metadata.py @@ -36,18 +36,31 @@ import tempfile import unittest -EMPTY_PNG_DATA = \ - '\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x01\x00\x00\x00\x01\x08' \ - '\x02\x00\x00\x00\x90wS\xde\x00\x00\x00\x0cIDATx\x9cc```\x00\x00\x00\x04' \ - '\x00\x01\xf6\x178U\x00\x00\x00\x00IEND\xaeB`\x82' +EMPTY_JPG_DATA = \ + '\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x01\x00H\x00H\x00\x00\xff\xdb' \ + '\x00C\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' \ + '\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' \ + '\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' \ + '\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xc0\x00\x0b\x08' \ + '\x00\x01\x00\x01\x01\x01\x11\x00\xff\xc4\x00\x1f\x00\x00\x01\x05\x01\x01' \ + '\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06' \ + '\x07\x08\t\n\x0b\xff\xc4\x00\xb5\x10\x00\x02\x01\x03\x03\x02\x04\x03\x05' \ + '\x05\x04\x04\x00\x00\x01}\x01\x02\x03\x00\x04\x11\x05\x12!1A\x06\x13Qa' \ + '\x07"q\x142\x81\x91\xa1\x08#B\xb1\xc1\x15R\xd1\xf0$3br\x82\t\n\x16\x17' \ + "\x18\x19\x1a%&\'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz\x83\x84\x85" \ + '\x86\x87\x88\x89\x8a\x92\x93\x94\x95\x96\x97\x98\x99\x9a\xa2\xa3\xa4\xa5' \ + '\xa6\xa7\xa8\xa9\xaa\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xc2\xc3\xc4\xc5' \ + '\xc6\xc7\xc8\xc9\xca\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xe1\xe2\xe3\xe4' \ + '\xe5\xe6\xe7\xe8\xe9\xea\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xff\xda' \ + '\x00\x08\x01\x01\x00\x00?\x00\x92\xbf\xff\xd9' class TestImageMetadata(unittest.TestCase): def setUp(self): # Create an empty image file - fd, self.pathname = tempfile.mkstemp(suffix='.png') - os.write(fd, EMPTY_PNG_DATA) + fd, self.pathname = tempfile.mkstemp(suffix='.jpg') + os.write(fd, EMPTY_JPG_DATA) os.close(fd) # Write some metadata m = ImageMetadata(self.pathname) @@ -482,7 +495,7 @@ class TestImageMetadata(unittest.TestCase): #################### def _set_up_other(self): - self.other = ImageMetadata.from_buffer(EMPTY_PNG_DATA) + self.other = ImageMetadata.from_buffer(EMPTY_JPG_DATA) def test_copy_metadata(self): self.metadata.read() |