diff --git a/test/test_compound_identifier.py b/test/test_compound_identifier.py index fd588890f..1ea5a4744 100644 --- a/test/test_compound_identifier.py +++ b/test/test_compound_identifier.py @@ -27,11 +27,6 @@ def test_is_key_header_positive(compound_identifier, header): @pytest.mark.parametrize("header", ["id","smiles","inchi","input", "some_header", "random", "header", ""]) def test_is_key_header_negative(compound_identifier, header): assert not compound_identifier.is_key_header(header) - -def test_guess_type_with_inchikey(compound_identifier): - inchikey = "LFQSCWFLJHTTHZ-UHFFFAOYSA-N" - result = compound_identifier.guess_type(inchikey) - assert result == "inchikey" @pytest.mark.parametrize("inchikey", [ @@ -43,6 +38,24 @@ def test_is_inchikey_positive(compound_identifier, inchikey): """Test that valid InChIKeys return True.""" assert compound_identifier._is_inchikey(inchikey) is True + +@pytest.mark.parametrize("inchikey", [ + "BSYNRYMUTXBXSQUHFFFAOYSA", + "BSYNRYMUTXBXSQ-UHFFFAOYSA-XY", + "12345678901234-1234567890-X", + "BSYNRYMUTXBXSQ_UHFFFAOYSA-N", + "BSYNRYMUTXBXSQ-UHFFFAOYSA" +]) +def test_is_inchikey_negative(compound_identifier, inchikey): + """Test that invalid InChIKeys return False.""" + assert not compound_identifier._is_inchikey(inchikey) + + +def test_guess_type_with_inchikey(compound_identifier): + inchikey = "LFQSCWFLJHTTHZ-UHFFFAOYSA-N" + result = compound_identifier.guess_type(inchikey) + assert result == "inchikey" + @patch('ersilia.utils.identifiers.compound.CompoundIdentifier._pubchem_smiles_to_inchikey') def test_is_smiles_positive_chem_none(mock_pubchem, compound_identifier):