def test__image_ext_content_type_known_type(self): """Image._image_ext_content_type() correct for known content type""" # exercise --------------------- content_type = Image._image_ext_content_type('.jpeg') # verify ----------------------- expected = 'image/jpeg' actual = content_type msg = ("expected content type '%s', got '%s'" % (expected, actual)) self.assertEqual(expected, actual, msg)
def test__image_ext_content_type_known_type(self): """ Image._image_ext_content_type() correct for known content type """ # exercise --------------------- content_type = Image._image_ext_content_type('jPeG') # verify ----------------------- expected = 'image/jpeg' actual = content_type msg = ("expected content type '%s', got '%s'" % (expected, actual)) self.assertEqual(expected, actual, msg)
def test__image_ext_content_type_raises_on_bad_ext(self): with self.assertRaises(ValueError): Image._image_ext_content_type('xj7')
def test__image_ext_content_type_raises_on_bad_ext(self): with self.assertRaises(ValueError): Image._image_ext_content_type('xj7')
def test__image_ext_content_type_raises_on_non_img_ext(self): with self.assertRaises(TypeError): Image._image_ext_content_type('.xml')