sustainable-processes / pura

Clean chemical data quickly
MIT License
10 stars 3 forks source link

Sweep: Unit test PubChem service #47

Open marcosfelt opened 1 year ago

marcosfelt commented 1 year ago

Write unit tests in tests/test_services for the PubChem class in pura/services/pubchem.py. Here are some name and SMILES pairs that you can use as examples:

"Josiphos SL-J001-1", "CC(C1CCCC1P(C2=CC=CC=C2)C3=CC=CC=C3)P(C4CCCCC4)C5CCCCC5.C1CCCC1.[Fe]"
"Acetone", "CC(=O)C"
sweep-ai[bot] commented 1 year ago

Hey @marcosfelt,

I've started working on this PR. The plan is to create a new test file tests/test_services/test_pubchem.py where we'll add unit tests for the PubChem class in pura/services/pubchem.py. We'll be testing the resolve_compound method using the provided name and SMILES pairs as test data. We'll use pytest for the testing framework and mock the ClientSession object to simulate the HTTP requests.

Give me a minute!

Some code snippets I looked at (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/sustainable-processes/pura/blob/e208bca7b80a79f71a4cbd3b6db70db8f04f4e3f/pura/resolvers.py#L119-L167 https://github.com/sustainable-processes/pura/blob/e208bca7b80a79f71a4cbd3b6db70db8f04f4e3f/pura/resolvers.py#L543-L574 https://github.com/sustainable-processes/pura/blob/e208bca7b80a79f71a4cbd3b6db70db8f04f4e3f/pura/services/chemspider.py#L1-L49 https://github.com/sustainable-processes/pura/blob/e208bca7b80a79f71a4cbd3b6db70db8f04f4e3f/tests/test_resolvers.py#L167-L212 https://github.com/sustainable-processes/pura/blob/e208bca7b80a79f71a4cbd3b6db70db8f04f4e3f/pura/services/pubchem.py#L1-L320

I'm a bot that handles simple bugs and feature requests but I might make mistakes. Please be kind!