Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
30 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import pytest | ||
import json | ||
from monty.io import zopen | ||
from emmet.core.vasp.material import MaterialsDoc | ||
from emmet.core.vasp.task import TaskDocument | ||
from emmet.core.vasp.calc_types import TaskType | ||
|
||
|
||
@pytest.fixture | ||
def test_tasks(test_dir): | ||
with zopen(test_dir / "test_si_tasks.json.gz") as f: | ||
tasks = json.load(f) | ||
|
||
tasks = [TaskDocument(**t) for t in tasks] | ||
return tasks | ||
|
||
|
||
def test_make_mat(test_tasks): | ||
|
||
material = MaterialsDoc.from_tasks(test_tasks) | ||
assert material.formula_pretty == "Si" | ||
assert len(material.task_ids) == 4 | ||
assert len(material.entries) == 1 | ||
|
||
bad_task_group = [ | ||
task for task in test_tasks if task.task_type != TaskType.Structure_Optimization | ||
] | ||
|
||
with pytest.raises(Exception): | ||
MaterialsDoc.from_tasks(bad_task_group) |
Binary file not shown.