Skip to content

Commit

Permalink
Test case for invalid UTF-8 metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
damianmoore committed Aug 8, 2021
1 parent cce5220 commit 7368450
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Binary file added tests/photos/invalid_utf8.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@


def test_metadata():
# General exif metadata
# General EXIF metadata
photo_path = str(Path(__file__).parent / 'photos' / 'snow.jpg')
metadata = PhotoMetadata(photo_path)
assert metadata.get('Image Size') == '800x600'
assert metadata.get('Date Time') == '2018:02:28 07:16:25'
assert metadata.get('Make') == 'Xiaomi'
assert metadata.get('ISO') == '100'

# Ignore invalid UTF-8 that might be in the metadata
photo_path = str(Path(__file__).parent / 'photos' / 'invalid_utf8.jpg')
metadata = PhotoMetadata(photo_path)
assert len(metadata.get_all().keys()) > 30
assert metadata.get('Artist') == ''


def test_location():
# Conversion from GPS exif data to latitude/longitude
Expand Down

0 comments on commit 7368450

Please sign in to comment.