Skip to content

Commit

Permalink
fix: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kohulan committed Mar 8, 2024
1 parent 3638d7e commit 1068c8a
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions tests/test_functions.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
import pytest

from DECIMER import predict_SMILES
from DECIMER import predict_SMILES_with_confidence


@pytest.mark.filterwarnings("ignore::DeprecationWarning")
def test_imagetosmiles():
img_path = "Tests/caffeine.png"
img_path = "tests/caffeine.png"
expected_result = "CN1C=NC2=C1C(=O)N(C)C(=O)N2C"
actual_result = predict_SMILES(img_path)
assert expected_result == actual_result


@pytest.mark.filterwarnings("ignore::DeprecationWarning")
def test_imagetosmilesWithConfidence():
img_path = "Tests/caffeine.png"
actual_result = predict_SMILES_with_confidence(img_path)
img_path = "tests/caffeine.png"
actual_result = predict_SMILES(img_path, confidence=True)

for element, confidence in actual_result:
assert (
confidence >= 0.9
), f"Confidence for element '{element}' is below 0.9 (confidence: {confidence})"


@pytest.mark.filterwarnings("ignore::DeprecationWarning")
def test_imagetosmileshanddrawn():
img_path = "tests/caffeine.png"
expected_result = "CN1C=NC2=C1C(=O)N(C)C(=O)N2C"
actual_result = predict_SMILES(img_path, hand_drawn=True)
assert expected_result == actual_result

0 comments on commit 1068c8a

Please sign in to comment.