Skip to content

Commit

Permalink
test suite for oxidation doc
Browse files Browse the repository at this point in the history
  • Loading branch information
shyamd committed Jun 26, 2021
1 parent d354f32 commit 590c503
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/emmet-builders/test_oxidation.py
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()])

0 comments on commit 590c503

Please sign in to comment.