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 a positive test unit for _is_smiles when chem is none in test_compound_identifier.py #1332

Merged
merged 4 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
12 changes: 11 additions & 1 deletion test/test_compound_identifier.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest
from ersilia.utils.identifiers.compound import CompoundIdentifier
from unittest.mock import patch

@pytest.fixture
def compound_identifier():
Expand All @@ -18,8 +19,17 @@ def test_is_input_header_negative(compound_identifier, header):
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)

@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
mock_pubchem.return_value = "InChIKey"

# Test with a valid SMILES input
smiles_string = 'CCO' #Ethanol SMILES
assert compound_identifier._is_smiles(smiles_string) is True

Loading