def test_extract_meta_data_dnr_fields(input_ft, input_dnr, expect_meta_data): input_row = {'test': 'row'} get_dnr = patch.object(si, '_get_descriptive_non_repeating_dict', return_value=input_dnr) get_ft = patch.object(si, '_get_freetext_dict', return_value=input_ft) with get_dnr as mock_dnr, get_ft as mock_ft: actual_meta_data = si._extract_meta_data(input_row) mock_dnr.assert_called_once_with(input_row) mock_ft.assert_called_once_with(input_row) assert actual_meta_data == expect_meta_data
def test_ext_meta_data_description(input_ft, input_dnr, expect_description): description_types = {'description', 'summary'} input_row = {'test': 'row'} get_dnr = patch.object(si, '_get_descriptive_non_repeating_dict', return_value=input_dnr) get_ft = patch.object(si, '_get_freetext_dict', return_value=input_ft) with get_dnr as mock_dnr, get_ft as mock_ft: meta_data = si._extract_meta_data(input_row, description_types=description_types) actual_description = meta_data.get('description') mock_dnr.assert_called_once_with(input_row) mock_ft.assert_called_once_with(input_row) assert actual_description == expect_description