-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # emmet-builders/emmet/builders/materials/oxidation_states.py
- Loading branch information
Showing
5 changed files
with
45 additions
and
11 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 |
---|---|---|
|
@@ -106,7 +106,6 @@ ENV/ | |
|
||
# PyCharm | ||
.idea | ||
<<<<<<< HEAD | ||
|
||
# Pytest | ||
.pytest_cache | ||
|
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
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 | ||
from maggma.stores import JSONStore, MemoryStore | ||
|
||
from emmet.builders.materials.oxidation_states import OxidationStatesBuilder | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def fake_materias(test_dir): | ||
entries = JSONStore(test_dir / "LiTiO2_batt.json", key="entry_id") | ||
entries.connect() | ||
|
||
materials_store = MemoryStore(key="material_id") | ||
materials_store.connect() | ||
|
||
for doc in entries.query(): | ||
materials_store.update( | ||
{"material_id": doc["entry_id"], "structure": doc["structure"]} | ||
) | ||
return materials_store | ||
|
||
|
||
def test_oxidation_store(fake_materias): | ||
oxi_store = MemoryStore() | ||
builder = OxidationStatesBuilder( | ||
materials=fake_materias, oxidation_states=oxi_store | ||
) | ||
builder.run() | ||
|
||
assert oxi_store.count() == 6 | ||
assert all([isinstance(d["composition"], dict) for d in oxi_store.query()]) |