本文整理匯總了Python中FileManager.FileManager.list_image_from_path方法的典型用法代碼示例。如果您正苦於以下問題:Python FileManager.list_image_from_path方法的具體用法?Python FileManager.list_image_from_path怎麽用?Python FileManager.list_image_from_path使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FileManager.FileManager
的用法示例。
在下文中一共展示了FileManager.list_image_from_path方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: FileManagerTest
# 需要導入模塊: from FileManager import FileManager [as 別名]
# 或者: from FileManager.FileManager import list_image_from_path [as 別名]
class FileManagerTest(unittest.TestCase):
def setUp(self):
self.file_manager= FileManager()
self.current_path = os.getcwd()
def test_aget_current_path_return_the_current_path(self):
self.assertEquals(self.current_path, self.file_manager.get_current_path())
def test_blist_image_from_path_return_a_list_with_images(self):
self.assertEquals(['apple.bmp', 'pregoneroOficial.jpg', 'tank.png', 'apple.bmp', 'bmp.bmp', 'linux.png', 'pregoneroOficial.jpg', 'programmer.jpg', 'test.jpg'], self.file_manager.list_image_from_path(self.current_path))
def test_clist_image_from_path_return_a_list_with_images_with_three_matching_files_and_one_different(self):
folder = "/input/moreimages"
path = self.current_path + folder
self.assertEquals(['apple.bmp', 'bmp.bmp', 'linux.png', 'pregoneroOficial.jpg', 'programmer.jpg', 'test.jpg'], self.file_manager.list_image_from_path(path))
def test_dlist_image_from_path_return_a_empty_list_when_no_images_exist(self):
folder="/input/empty"
path = self.current_path + folder
self.assertEquals([], self.file_manager.list_image_from_path(path))
def test_everify_path_directory_exists_when_user_insert_a_valid_path(self):
self.assertEquals(self.current_path, self.file_manager.directory_exists(self.current_path))
def test_fverify_path_directory_exists_when_user_insert_an_invalid_path(self):
self.assertEquals("This is an invalid path", self.file_manager.directory_exists("InvalidPath"))
def test_gverify_image_exist_when_user_insert_an_existing_image(self):
folder = "/input/tank.png"
path_image = self.current_path + folder
self.assertTrue(self.file_manager.validate_type_of_image(path_image))
def test_hverify_image_exist_when_user_insert_an_unexisting_image(self):
image = "/input/92.jpg"
path_image = self.current_path + image
self.assertFalse(self.file_manager.validate_type_of_image(image))
def test_iverify_image_exist_when_user_insert_an_unexisting_image(self):
txt_file = "/input/moreimages/readme.txt"
path_file = self.current_path + txt_file
self.assertFalse(self.file_manager.validate_type_of_image(path_file))