diff --git a/tests/test_RapidPeptidesGenerator.py b/tests/test_RapidPeptidesGenerator.py index 5f018b43e9cfe2f63120f3b408eff7c35056371b..335305e4bddb6435b282aca6e630025926a6c1e1 100644 --- a/tests/test_RapidPeptidesGenerator.py +++ b/tests/test_RapidPeptidesGenerator.py @@ -45,6 +45,24 @@ def test_restricted_enzyme_id(capsys): # Normal test assert RapidPeptidesGenerator.restricted_enzyme_id("asp-n") == "asp-n" +def test_restricted_int(capsys): + """Test function 'restricted_int(mc_val)'""" + # Error test + with pytest.raises(SystemExit) as pytest_wrapped_e: + RapidPeptidesGenerator.restricted_int(-10) + _, err = capsys.readouterr() + assert err == "Value Error: miscleavage value should be greater then 0.\n" + assert pytest_wrapped_e.type == SystemExit + assert pytest_wrapped_e.value.code == 1 + with pytest.raises(SystemExit) as pytest_wrapped_e: + RapidPeptidesGenerator.restricted_int("z") + _, err = capsys.readouterr() + assert err == "Type Error: miscleavage value should be an integer.\n" + assert pytest_wrapped_e.type == SystemExit + assert pytest_wrapped_e.value.code == 1 + # Normal test + assert RapidPeptidesGenerator.restricted_int(3) == 3 + def test_list_enzyme(capsys): """Test function 'list_enzyme()' This test should be run with empty user file