def initcietor_for_xml_tests(self): test_data = {} pascal_reader = PascalDatasetReader() pascal_reader._test_structure_exist(self.dataset_name) xmls = load_xml_paths(pascal_reader.annotations_folder_path) read_xml = pascal_reader._read_xml(xmls[0]) return read_xml
def test_extract_data_from_image_folder(self): test_data = {} pascal_reader = PascalDatasetReader() pascal_reader._test_structure_exist(self.dataset_name) test_data = pascal_reader._extract_data_from_image_folder(test_data) self.assertEqual(isinstance(test_data['images'], list), True) self.assertEqual(len(test_data['images']) > 0, True)
def test_changing_folder_names_to_find(self): images_folder_name = 'test_changing_folder_names_to_find' annotations_folder_name = 'test_changing_folder_names_to_find' pascal_reader = PascalDatasetReader() pascal_reader.change_folder_to_find_names( images_folder_name=images_folder_name, annotations_folder_name=annotations_folder_name) self.assertEqual(pascal_reader.images_folder_name, images_folder_name) self.assertEqual(pascal_reader.annotations_folder_name, annotations_folder_name)
def test_xlm_paths_loading(self): pascal_reader = PascalDatasetReader() pascal_reader._test_structure_exist(self.dataset_name) xmls = load_xml_paths(pascal_reader.annotations_folder_path) self.assertEqual(len(xmls) > 0, True)
def test_test_structure_exist(self): pascal_reader = PascalDatasetReader() self.assertEqual( pascal_reader._test_structure_exist(self.dataset_name), True)
def test_PascalFoldersNamesError_raise(self): dataset_path = 'test_files' pascal_reader = PascalDatasetReader() self.assertRaises(FoldersNamesError, pascal_reader.get_data, dataset_path)
def test_if_output_data_have_images(self): pascal_reader = PascalDatasetReader() data_in_output_format = pascal_reader.get_data(self.dataset_name) self.assertEqual( len(data_in_output_format['dataset_classes']) > 0, True)