def test_top_ions(peak): with pytest.warns(DeprecationWarning): assert isinstance(top_ions_v1(peak, 10), list) with pytest.warns(DeprecationWarning): assert len(top_ions_v1(peak, 10)) == 10 with pytest.warns(DeprecationWarning): assert len(top_ions_v1(peak)) == 5 with pytest.warns(DeprecationWarning): assert top_ions_v1(peak, 10)[0] == 55 for obj in [test_string, *test_numbers, test_dict, *test_lists]: with pytest.raises(TypeError): with pytest.warns(DeprecationWarning): top_ions_v1(obj) for obj in [test_string, test_float, test_dict, *test_lists]: with pytest.raises(TypeError): with pytest.warns(DeprecationWarning): top_ions_v1(peak, obj) with pytest.warns(DeprecationWarning): assert isinstance(top_ions_v2(peak, 10), list) with pytest.warns(DeprecationWarning): assert len(top_ions_v2(peak, 10)) == 10 with pytest.warns(DeprecationWarning): assert len(top_ions_v2(peak)) == 5 with pytest.warns(DeprecationWarning): assert top_ions_v2(peak, 10)[0] == 55 for obj in [test_string, *test_numbers, test_dict, *test_lists]: with pytest.raises(TypeError): with pytest.warns(DeprecationWarning): top_ions_v2(obj) for obj in [test_string, test_float, test_dict, *test_lists]: with pytest.raises(TypeError): with pytest.warns(DeprecationWarning): top_ions_v2(peak, obj) assert isinstance(peak.top_ions(10), list) assert len(peak.top_ions(10)) == 10 assert len(peak.top_ions()) == 5 assert peak.top_ions(10)[0] == 55 for obj in [test_string, test_float, test_dict, *test_lists]: with pytest.raises(TypeError): peak.top_ions(obj)
def test_top_ions_v2(peak): with pytest.warns(DeprecationWarning): top_ions_v2(peak, 10)