Skip to content

Commit

Permalink
#2312 - Export of ambiguous monomers doesn't work (error appears) to …
Browse files Browse the repository at this point in the history
…any export format (even to SVG/PNG) except KET (#2528)
  • Loading branch information
AliaksandrDziarkach authored Oct 8, 2024
1 parent 1b172eb commit a73614f
Show file tree
Hide file tree
Showing 11 changed files with 637 additions and 7 deletions.
10 changes: 10 additions & 0 deletions api/tests/integration/ref/formats/ket_ambiguous_export.py.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Test mol v2000
molecule: Ambiguous monomer cannot be transform to SGroup.
Test mol v3000
molfile saver: Ambiguous monomer cannot be saved to molfile.
Test cdxml
molecule: Ambiguous monomer cannot be transform to SGroup.
Test cml
molecule: Ambiguous monomer cannot be transform to SGroup.
Test smiles
*
53 changes: 53 additions & 0 deletions api/tests/integration/tests/formats/ket_ambiguous_export.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import difflib
import os
import sys


def find_diff(a, b):
return "\n".join(difflib.unified_diff(a.splitlines(), b.splitlines()))


sys.path.append(
os.path.normpath(
os.path.join(os.path.abspath(__file__), "..", "..", "..", "common")
)
)
from env_indigo import ( # noqa
Indigo,
IndigoException,
getIndigoExceptionText,
joinPathPy,
)

indigo = Indigo()

root = joinPathPy("molecules/macro/", __file__)

mol = indigo.loadMoleculeFromFile(os.path.join(root, "ambiguous.ket"))
print("Test mol v2000")
try:
indigo.setOption("molfile-saving-mode", "2000")
print(mol.molfile())
except IndigoException as e:
print(getIndigoExceptionText(e))
print("Test mol v3000")
try:
indigo.setOption("molfile-saving-mode", "3000")
print(mol.molfile())
except IndigoException as e:
print(getIndigoExceptionText(e))
print("Test cdxml")
try:
print(mol.cdxml())
except IndigoException as e:
print(getIndigoExceptionText(e))
print("Test cml")
try:
print(mol.cml())
except IndigoException as e:
print(getIndigoExceptionText(e))
print("Test smiles")
try:
print(mol.smiles())
except IndigoException as e:
print(getIndigoExceptionText(e))
Loading

0 comments on commit a73614f

Please sign in to comment.