Skip to content
Snippets Groups Projects
Commit 107a4402 authored by James Graham's avatar James Graham
Browse files

Added JSON converter test

parent c128579f
Branches
No related tags found
No related merge requests found
import unittest
from pycgtool.parsers.json import CFG
from pycgtool.parsers.json import CFG, jsonify
class TestParsersJson(unittest.TestCase):
......@@ -53,6 +53,22 @@ class TestParsersJson(unittest.TestCase):
with self.assertRaises(KeyError):
cfg = CFG("test/data/water.json", "potato")
def test_convert(self):
jsonify("test/data/sugar.map", "test/data/sugar.bnd", "test.json")
test_json = CFG("test.json", from_section="molecules")
ref_json = CFG("test/data/sugar.json", from_section="molecules")
for tbead, rbead in zip(test_json["ALLA"].beads, ref_json["ALLA"].beads):
self.assertEqual(tbead, rbead)
for tbond, rbond in zip(test_json["ALLA"].bonds, ref_json["ALLA"].bonds):
self.assertEqual(tbond, rbond)
for tbead, rbead in zip(test_json["SOL"].beads, ref_json["SOL"].beads):
self.assertEqual(tbead, rbead)
for tbond, rbond in zip(test_json["SOL"].bonds, ref_json["SOL"].bonds):
self.assertEqual(tbond, rbond)
if __name__ == '__main__':
unittest.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment