""" 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 ##