MCPcopy
hub / github.com/idealo/imagededup / test_find_duplicates_to_remove_encoding_map

Function test_find_duplicates_to_remove_encoding_map

tests/test_cnn.py:744–773  ·  view source on GitHub ↗
(cnn, mocker, mocker_save_json)

Source from the content-addressed store, hash-verified

742
743
744def test_find_duplicates_to_remove_encoding_map(cnn, mocker, mocker_save_json):
745 threshold = 0.9
746 outfile = True
747 ret_val_find_dup_dict = {
748 'filename.jpg': ['dup1.jpg'],
749 'filename2.jpg': ['dup2.jpg'],
750 }
751 ret_val_get_files_to_remove = ['1.jpg', '2.jpg']
752 encoding_map = data_encoding_map()
753 find_duplicates_mocker = mocker.patch(
754 'imagededup.methods.cnn.CNN.find_duplicates', return_value=ret_val_find_dup_dict
755 )
756 get_files_to_remove_mocker = mocker.patch(
757 'imagededup.methods.cnn.get_files_to_remove',
758 return_value=ret_val_get_files_to_remove,
759 )
760 cnn.find_duplicates_to_remove(
761 encoding_map=encoding_map, min_similarity_threshold=threshold, outfile=outfile
762 )
763 find_duplicates_mocker.assert_called_once_with(
764 encoding_map=encoding_map,
765 image_dir=None,
766 min_similarity_threshold=threshold,
767 scores=False,
768 recursive=False,
769 num_enc_workers=0,
770 num_sim_workers=cpu_count()
771 )
772 get_files_to_remove_mocker.assert_called_once_with(ret_val_find_dup_dict)
773 mocker_save_json.assert_called_once_with(ret_val_get_files_to_remove, outfile)
774
775
776# Integration tests

Callers

nothing calls this directly

Calls 2

data_encoding_mapFunction · 0.85

Tested by

no test coverage detected