This repository includes a simple command-line script (test_api.py) for testing the Makya scoring API. Its primary goal is to make it easy for developers to verify that their Makya API instance is running and producing the expected output for various SMILES string cases (valid, single, and invalid).
- Health Check: Verifies if the API is running and healthy.
- Scoring Tests: Verifies if the API returns the expected number of scores for provided SMILES strings.
- Error Handling: Checks how the API handles and reports invalid SMILES.
-
Install dependencies
Make sure you haverequestsinstalled:pip install requests
or use the provided Poetry environment (recommended):
poetry install
-
Run the test script
By default, the script will targethttp://localhost:5555. You can change this (and set request timeouts) using the arguments shown below.python test_api.py
or use Poetry with:
poetry run task run
Optional arguments:
--api-url: Base URL of the API (default:http://localhost:5555)--timeout: HTTP timeout in seconds (default: 15)
Example:
python test_api.py --api-url http://your-api-host:5555 --timeout 10
-
Follow the prompt
The script will ask you how many scores the API should return per SMILES string.
When the script runs successfully, you should expect output like the following:
Welcome! Let's collect a tiny bit of information before testing.
How many scores should the API return for each SMILES? 1
✅ API availability: Health endpoint responded with status 200.
✅ Multiple valid SMILES: Received 1 score(s) for each SMILES entry.
✅ Single SMILES: Received 1 score(s) for each SMILES entry.
✅ Invalid SMILES: Invalid SMILES received null scores as expected.
If a test fails, you will see a ❌ and a more detailed error message.
To add more SMILES examples, simply edit the VALID_SMILES_LIST, SINGLE_SMILES_LIST, or INVALID_SMILES_LIST variables in test_api.py.
To add more use cases, follow the usage of the UseCase class to implement your own tests.
This source code project is provided as an example for educational and illustrative purposes only. While efforts have been made to ensure the accuracy and reliability of the code, no guarantee is made regarding its suitability for any specific purpose.
By accessing and using this source code, you agree that:
- The code is provided "as is" without warranty of any kind, express or implied.
- You acknowledge that you are solely responsible for any consequences resulting from the use of this code.
- The author(s) and contributors of this code shall not be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) arising in any way out of the use of this code, even if advised of the possibility of such damage.
- Copyright © 2024 Iktos. All rights reserved.
This disclaimer does not limit or exclude any liability for death or personal injury resulting from negligence, fraud, or any other liability that cannot be excluded or limited under applicable law.
Use of this source code project implies acceptance of these terms.