def test_list_of_sets_to_list_of_lists(): input_sets = [{'a', 'b'}, {'b', 'c'}] result = list_of_sets_to_list_of_lists(input_sets) assert isinstance(result, list), 'result is not a list' for item in result: assert isinstance(item, list), '{} is not a list'.format(item) assert ['a', 'b'] in result, 'first list not found' assert list_of_sets_to_list_of_lists(None) == []
def test_list_of_sets_to_list_of_lists(self): input_sets = [{'a', 'b'}, {'b', 'c'}] result = list_of_sets_to_list_of_lists(input_sets) self.assertIsInstance(result, list, 'result is not a list') for item in result: self.assertIsInstance(item, list, '{} is not a list'.format(item)) self.assertIn(['a', 'b'], result, 'first list not found') assert list_of_sets_to_list_of_lists(None) == []
def test_list_of_sets_to_list_of_lists(self): input_sets = [{'a', 'b'}, {'b', 'c'}] result = list_of_sets_to_list_of_lists(input_sets) self.assertIsInstance(result, list, "result is not a list") for item in result: self.assertIsInstance(item, list, "{} is not a list".format(item)) self.assertIn(['a', 'b'], result, "first list not found")
def _get_similar_files(self, fo_list, exclusive_files): similars = list() similarity = dict() for index, _ in enumerate(fo_list): tmp_list = deepcopy(fo_list) parent_one = tmp_list.pop(index) for parent_two in tmp_list: for file_one in exclusive_files[parent_one.uid]: for item, value in self._find_similar_file_for(file=file_one, parent_id=parent_one.uid, potential_matches=parent_two): similars.append(item) similarity[convert_uid_list_to_compare_id(item)] = value similarity_sets = self.produce_similarity_sets(remove_duplicates_from_list_of_lists(similars)) remove_subsets_from_list_of_sets(similarity_sets) return remove_duplicates_from_list_of_lists(list_of_sets_to_list_of_lists(similarity_sets)), similarity