Skip to content

Commit

Permalink
#2574 - Support for Collapsed monomers
Browse files Browse the repository at this point in the history
Add code to load/save. Add UTs
  • Loading branch information
AliaksandrDziarkach committed Nov 22, 2024
1 parent 7c0b09c commit 17e6ccb
Show file tree
Hide file tree
Showing 18 changed files with 2,061 additions and 40 deletions.
2 changes: 2 additions & 0 deletions api/tests/integration/ref/formats/ket_to_ket.py.out
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
*** KET to KET ***
images.ket:SUCCEED
monomer_shape.ket molecule: SUCCEED
monomer_shape.ket molecule: SUCCEED
31 changes: 30 additions & 1 deletion api/tests/integration/tests/formats/ket_to_ket.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def find_diff(a, b):
os.path.join(os.path.abspath(__file__), "..", "..", "..", "common")
)
)
from env_indigo import * # noqa
from env_indigo import Indigo, joinPathPy # noqa

indigo = Indigo()
indigo.setOption("json-saving-pretty", True)
Expand Down Expand Up @@ -42,3 +42,32 @@ def find_diff(a, b):
else:
print(filename + ".ket:FAILED")
print(diff)


def check_res(filename, format, ket_ref, ket):
diff = find_diff(ket_ref, ket)
if not diff:
print("{}.ket {}: SUCCEED".format(filename, format))
else:
print("{}.ket {}: FAILED".format(filename, format))
print(diff)


indigo.setOption("json-use-native-precision", True)
files = [
"monomer_shape",
]
formats = {
"mol": indigo.loadMolecule,
"doc": indigo.loadKetDocument,
}
for filename in sorted(files):
for format, loader in formats.items():
file_path = os.path.join(ref_path, filename)
with open("{}_{}.ket".format(file_path, format), "r") as file:
ket_ref = file.read()
mol = loader(ket_ref)
# with open("{}_{}.ket".format(file_path, format), "w") as file:
# file.write(mol.json())
ket = mol.json()
check_res(filename, "molecule", ket_ref, ket)
Loading

0 comments on commit 17e6ccb

Please sign in to comment.