Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add positive test for the _is_inchikey method in CompoundIdentifier class #1333

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

Loading