From e56bc9722b6c1bf3831c639a38a2cef6e313c94e Mon Sep 17 00:00:00 2001 From: Nathan Ostgard Date: Thu, 7 Jan 2016 17:10:55 -0800 Subject: [PATCH] gh-65 Fix files with empty extensions being detected as audio files --- elodie/media/audio.py | 2 +- elodie/tests/media/media_test.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/elodie/media/audio.py b/elodie/media/audio.py index 89a1f38..92475a6 100644 --- a/elodie/media/audio.py +++ b/elodie/media/audio.py @@ -9,7 +9,7 @@ from video import Video class Audio(Video): __name__ = 'Audio' - extensions = ('m4a') + extensions = ('m4a',) """ @param, source, string, The fully qualified path to the audio file diff --git a/elodie/tests/media/media_test.py b/elodie/tests/media/media_test.py index ff92c87..0ef94b5 100644 --- a/elodie/tests/media/media_test.py +++ b/elodie/tests/media/media_test.py @@ -14,6 +14,7 @@ sys.path.insert(0, os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirna sys.path.insert(0, os.path.abspath(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))) import helper +from elodie.media.audio import Audio from elodie.media.media import Media from elodie.media.photo import Photo from elodie.media.video import Video @@ -47,6 +48,11 @@ def test_get_class_by_file_unsupported(): assert media is None +def test_get_class_by_file_empty(): + media = Media.get_class_by_file(helper.get_file('.DS_Store'), + [Photo, Video, Audio]) + assert media is None + def is_valid(): media = Media()