-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from sparks-baird/cli
working cli via `xtal2png --encode ...` and `xtal2png --decode ...` syntax
- Loading branch information
Showing
4 changed files
with
191 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,3 +54,4 @@ MANIFEST | |
.python-version | ||
src/xtal2png/meta.yaml | ||
xtal2png/meta.yaml | ||
tmp/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from os import path | ||
|
||
from xtal2png.core import main, parse_args | ||
|
||
|
||
def test_parse_encode_args(): | ||
args = parse_args(["--encode", "--path", "src/xtal2png/utils/Zn2B2PbO6.cif"]) | ||
return args | ||
|
||
|
||
def test_parse_decode_args(): | ||
args = parse_args( | ||
["--decode", "--path", "data/external/preprocessed/Zn2B2PbO6.png"] | ||
) | ||
return args | ||
|
||
|
||
def test_encode_single(): | ||
fpath = path.join("src", "xtal2png", "utils", "Zn2B2PbO6.cif") | ||
args = ["--encode", "--path", fpath, "--save-dir", "tmp"] | ||
main(args) | ||
|
||
|
||
def test_encode_dir(): | ||
fpath = path.join("src", "xtal2png", "utils") | ||
args = ["--encode", "--path", fpath, "--save-dir", path.join("tmp", "tmp")] | ||
main(args) | ||
|
||
|
||
def test_decode_single(): | ||
fpath = path.join("data", "preprocessed", "Zn8B8Pb4O24,volume=623,uid=b62a.png") | ||
args = ["--decode", "--path", fpath, "--save-dir", "tmp"] | ||
main(args) | ||
|
||
|
||
def test_decode_dir(): | ||
fpath = path.join("data", "preprocessed") | ||
args = ["--decode", "--path", fpath, "--save-dir", "tmp"] | ||
main(args) | ||
|
||
|
||
if __name__ == "__main__": | ||
args = test_parse_encode_args() | ||
args = test_parse_decode_args() | ||
test_encode_single() | ||
test_encode_dir() | ||
test_decode_single() | ||
test_decode_dir() | ||
|
||
1 + 1 |