File size: 594 Bytes
e73ce34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from __future__ import annotations

import pytest
from DECIMER import predict_SMILES
from rdkit import Chem


@pytest.fixture
def test_smiles():
    return "CN1C(=O)C2=C(N=CN2C)N(C)C1=O"


def test_imagetosmiles(test_smiles):
    img_path = "tests/caffeine.png"
    expected_result = test_smiles
    actual_result = predict_SMILES(img_path)
    mol = Chem.MolFromSmiles(actual_result)
    if mol:
        actual_result_canonical = Chem.MolToSmiles(
            mol,
            isomericSmiles=True,
            kekuleSmiles=True,
        )
    assert expected_result == actual_result_canonical