-
Notifications
You must be signed in to change notification settings - Fork 62
/
test_oxidation_states.py
53 lines (44 loc) · 1.21 KB
/
test_oxidation_states.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import pytest
from pymatgen.core import Structure
from pymatgen.util.testing import PymatgenTest
from emmet.core.oxidation_states import OxidationStateDoc
test_structures = {
name: struc
for name, struc in PymatgenTest.TEST_STRUCTURES.items()
if name
in [
"SiO2",
"Li2O",
"LiFePO4",
"TlBiSe2",
"K2O2",
"Li3V2(PO4)3",
"CsCl",
"Li2O2",
"NaFePO4",
"Pb2TiZrO6",
"SrTiO3",
]
}
fail_structures = {
name: struc
for name, struc in PymatgenTest.TEST_STRUCTURES.items()
if name
in [
"TiO2",
"BaNiO3",
"VO2",
]
}
@pytest.mark.parametrize("structure", test_structures.values())
def test_oxidation_state(structure: Structure):
"""Very simple test to make sure this actually works"""
doc = OxidationStateDoc.from_structure(structure)
print(structure.composition)
assert doc is not None
@pytest.mark.parametrize("structure", fail_structures.values())
def test_oxidation_state_failures(structure: Structure):
"""Very simple test to make sure this actually fails"""
doc = OxidationStateDoc.from_structure(structure)
print(structure.composition)
assert doc is None