Skip to content

Commit

Permalink
add positive test for the _is_inchikey method in CompoundIdentifier c…
Browse files Browse the repository at this point in the history
…lass (#1333)

Co-authored-by: Dhanshree Arora <DhanshreeA@users.noreply.github.com>
  • Loading branch information
adebisi4145 and DhanshreeA authored Nov 18, 2024
1 parent a12a9d2 commit e109bbb
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion test/test_compound_identifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,35 @@ def compound_identifier():
def test_is_input_header_positive(compound_identifier, header):
"""Test that valid input headers return True."""
assert compound_identifier.is_input_header(header) is True


@pytest.mark.parametrize("header", ["output", "invalid", "InChI", "inchikey"])
def test_is_input_header_negative(compound_identifier, header):
"""Test that invalid input headers return False."""
assert compound_identifier.is_input_header(header) is False


@pytest.mark.parametrize("header", ["key", "inchiKey", "KEY", "INCHIKEY"])
def test_is_key_header_positive(compound_identifier, header):
"""Test that valid key headers return True."""
assert compound_identifier.is_key_header(header) is True


@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)


@pytest.mark.parametrize("inchikey", [
"BSYNRYMUTXBXSQ-UHFFFAOYSA-N",
"BQJCRHHNABKAKU-KBQPJGBKSA-N",
"ZJPODVODJYKFHM-UHFFFAOYSA-N"
])
def test_is_inchikey_positive(compound_identifier, inchikey):
"""Test that valid InChIKeys return True."""
assert compound_identifier._is_inchikey(inchikey) is True


@patch('ersilia.utils.identifiers.compound.CompoundIdentifier._pubchem_smiles_to_inchikey')
def test_is_smiles_positive_chem_none(mock_pubchem, compound_identifier):
compound_identifier.Chem = None
Expand All @@ -32,4 +47,4 @@ def test_is_smiles_positive_chem_none(mock_pubchem, compound_identifier):
# Test with a valid SMILES input
smiles_string = 'CCO' #Ethanol SMILES
assert compound_identifier._is_smiles(smiles_string) is True

0 comments on commit e109bbb

Please sign in to comment.