Exemplo n.º 1
0
def reindex_files(image_files, image_topics):
    """
    Reindex files to follow required structure
    :param image_files:
    :param image_topics:
    :return:
    """
    image_reindexer = FileReindexer(image_files, image_topics)
    if user_confirmation(
            "%d/%d samples will be removed" %
        (len(image_reindexer.files_to_remove), len(image_files))):
        image_reindexer.clean_up()
    if user_confirmation("%d/%d samples with %d topics will be reindexed" %
                         (len(image_reindexer.files_to_reindex),
                          len(image_files), len(image_topics))):
        image_reindexer.reindex()
Exemplo n.º 2
0
 def test_clean_up__test_files_for_reindexing__rename_called_six_times(
         self, mock_method):
     unit = FileReindexer(self.TEST_FILES_FOR_REINDEXING, self.TEST_KEYS)
     unit.reindex()
     self.assertEqual(6, mock_method.call_count)
Exemplo n.º 3
0
 def test_clean_up__no_files_to_reindex__no_reindexing(self, mock_method):
     unit = FileReindexer([], self.TEST_KEYS)
     unit.reindex()
     mock_method.assert_not_called()