Skip to content

Commit

Permalink
Update test for positive inchikey (#1336)
Browse files Browse the repository at this point in the history
* Update test_compound_identifier.py

* Update test_compound_identifier.py

* Update test_compound_identifier.py

* Update test_compound_identifier.py

* Update test_compound_identifier.py

* Update test_compound_identifier.py

---------

Co-authored-by: Dhanshree Arora <[email protected]>
  • Loading branch information
tongyu0924 and DhanshreeA authored Nov 18, 2024
1 parent c4c790a commit a434b00
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion test/test_compound_identifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,24 @@ 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



@patch('requests.get')
async def test_nci_smiles_to_inchikey_positive(mock_get, compound_identifier):
"""Test _nci_smiles_to_inchikey with a mocked positive response."""
mock_response = mock_get.return_value
mock_response.status_code = 200
mock_response.text = "InChIKey=BSYNRYMUTXBXSQ-UHFFFAOYSA-N"

inchikey = await compound_identifier._nci_smiles_to_inchikey(session=None, smiles="CCO")
assert inchikey == "BSYNRYMUTXBXSQ-UHFFFAOYSA-N"


@patch('requests.get')
async def test_nci_smiles_to_inchikey_negative(mock_get, compound_identifier):
"""Test _nci_smiles_to_inchikey with a mocked negative response."""
mock_response = mock_get.return_value
mock_response.status_code = 404

inchikey = await compound_identifier._nci_smiles_to_inchikey(session=None, smiles="invalid_smiles")
assert inchikey is None

0 comments on commit a434b00

Please sign in to comment.