@@ -0,0 +1,1973 @@
+import os%0Aimport unittest%0A%0Aimport nose.tools as ntools%0A%0Afrom smqtk.representation.data_element.file_element import DataFileElement%0Afrom smqtk.tests import TEST_DATA_DIR%0Afrom smqtk.utils.image_utils import is_loadable_image, is_valid_element%0A%0A%0Aclass TestIsLoadableImage(unittest.TestCase):%0A%0A    def setUp(self):%0A        self.good_image = DataFileElement(os.path.join(TEST_DATA_DIR,%0A                                                       'Lenna.png'))%0A        self.non_image = DataFileElement(os.path.join(TEST_DATA_DIR,%0A                                                      'test_file.dat'))%0A%0A    @ntools.raises(AttributeError)%0A    def test_non_data_element_raises_exception(self):%0A        # should throw:%0A        # AttributeError: 'bool' object has no attribute 'get_bytes'%0A        is_loadable_image(False)%0A%0A%0A    def test_unloadable_image_returns_false(self):%0A        assert is_loadable_image(self.non_image) == False%0A%0A%0A    def test_unloadable_image_logs_warning(self):%0A        pass%0A%0A%0A    def test_loadable_image_returns_true(self):%0A        assert is_loadable_image(self.good_image) == True%0A%0A%0Aclass TestIsValidElement(unittest.TestCase):%0A%0A    def setUp(self):%0A        self.good_image = DataFileElement(os.path.join(TEST_DATA_DIR,%0A                                                       'Lenna.png'))%0A        self.non_image = DataFileElement(os.path.join(TEST_DATA_DIR,%0A                                                      'test_file.dat'))%0A%0A%0A    def test_non_data_element(self):%0A        assert is_valid_element(False) == False%0A%0A%0A    def test_invalid_content_type(self):%0A        # test it logs to debug%0A        assert is_valid_element(self.good_image, valid_content_types=%5B%5D) == False%0A%0A    def test_valid_content_type(self):%0A        assert is_valid_element(self.good_image,%0A                                valid_content_types=%5B'image/png'%5D) == True%0A%0A%0A    def test_invalid_image_returns_false(self):%0A        assert is_valid_element(self.non_image, check_image=True) == False%0A

Add unit tests for image_utils