1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
"""
Part of the bsie test suite.
A copy of the license is provided with the project.
Author: Matthias Baumgartner, 2022
"""
# standard imports
import os
import unittest
# bsie imports
from bsie.utils import errors
# objects to test
from bsie.reader.exif import Exif
## code ##
class TestExif(unittest.TestCase):
def test_call(self):
rdr = Exif()
# discards non-image files
self.assertRaises(errors.UnsupportedFileFormatError, rdr, 'invalid.doc')
# raises on invalid image files
self.assertRaises(errors.ReaderError, rdr, 'invalid.jpg')
# returns dict with exif info
self.assertDictEqual(rdr(os.path.join(os.path.dirname(__file__), 'testimage_exif.jpg')), {
'Exif.Image.Artist': 'nobody',
'Exif.Image.ExifTag': '110',
'Exif.Image.ResolutionUnit': '2',
'Exif.Image.XResolution': '300/1',
'Exif.Image.YCbCrPositioning': '1',
'Exif.Image.YResolution': '300/1',
'Exif.Photo.ColorSpace': '65535',
'Exif.Photo.ComponentsConfiguration': '1 2 3 0',
'Exif.Photo.ExifVersion': '48 50 51 50',
'Exif.Photo.FlashpixVersion': '48 49 48 48',
'Exif.Photo.ISOSpeedRatings': '200',
})
## main ##
if __name__ == '__main__':
unittest.main()
## EOF ##
|