def test_fill_peaks(im_i, peak_list): filled_peak_list = fill_peaks(im_i, peak_list, 10.0) assert is_peak_list(filled_peak_list) # Errors for obj in [test_dict, *test_sequences, *test_numbers, test_string]: with pytest.raises(TypeError): fill_peaks(im_i, obj, 10.0) for obj in [test_dict, *test_sequences, test_string, test_int]: with pytest.raises(TypeError): fill_peaks(im_i, peak_list, obj)
def test_sele_peaks_by_rt(filtered_peak_list): selected_peaks = sele_peaks_by_rt(filtered_peak_list, ("12m", "13m")) assert is_peak_list(selected_peaks) assert len(selected_peaks) == 18 peak = selected_peaks[0] assert isinstance(peak, Peak) uid = peak.UID assert uid == '68-54-26-722.30' assert peak.get_third_highest_mz() == 50 assert peak.bounds == [0, 683, 0] assert peak.get_int_of_ion(100) == 0.0 assert peak.rt == 722.299976349 assert peak.ic_mass is None assert peak.top_ions(10)[0] == 133 peak.null_mass(73) index_73 = peak.mass_spectrum.mass_list.index(73) assert peak.mass_spectrum.mass_spec[index_73] == 0 peak.crop_mass(100, 200) assert peak.UID != uid with pytest.raises(TypeError): sele_peaks_by_rt(filtered_peak_list, [1.2, 3.4]) with pytest.raises(ValueError): sele_peaks_by_rt(filtered_peak_list, ["50s", "10s"]) # Errors for obj in [test_dict, *test_sequences, *test_numbers, test_string]: with pytest.raises(TypeError): sele_peaks_by_rt(obj, ("12m", "13m")) for obj in [test_dict, *test_numbers, test_string]: with pytest.raises(TypeError): sele_peaks_by_rt(filtered_peak_list, obj) for obj in [*test_sequences]: with pytest.raises(ValueError): sele_peaks_by_rt(filtered_peak_list, obj)
def test_is_peak_list(peak_list, ms, im_i, data): assert is_peak_list(peak_list) assert not is_peak_list(test_int) assert not is_peak_list(test_string) assert not is_peak_list(test_float) assert not is_peak_list(test_list_strs) assert not is_peak_list(test_list_ints) assert not is_peak_list(test_tuple) assert not is_peak_list(test_dict) assert not is_peak_list(ms) assert not is_peak_list(im_i) assert not is_peak_list(data)