Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pycgtool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
James Graham
pycgtool
Commits
107a4402
Commit
107a4402
authored
9 years ago
by
James Graham
Browse files
Options
Downloads
Patches
Plain Diff
Added JSON converter test
parent
c128579f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_parsers_json.py
+17
-1
17 additions, 1 deletion
test/test_parsers_json.py
with
17 additions
and
1 deletion
test/test_parsers_json.py
+
17
−
1
View file @
107a4402
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
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment