File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11"""Test the oxygen evolution analysis features in the client."""
22
3+ import json
34import pytest
45import numpy as np
56from scipy .interpolate import splev
89from pymatgen .core import Composition
910from pymatgen .entries .computed_entries import ComputedEntry
1011
11- from mp_api .client .core ._oxygen_evolution import NIST_JANAF_O2_MU_T , OxygenEvolution
12+ from mp_api .client .core ._oxygen_evolution import DEFAULT_CACHE_FILE , NIST_JANAF_O2_MU_T , OxygenEvolution
1213
1314
1415def test_interp ():
@@ -37,6 +38,20 @@ def test_interp():
3738 with pytest .warns (UserWarning , match = "outside the fitting range" ):
3839 oxyevo .mu_to_temp_spline (badval )
3940
41+ def test_get ():
42+ """Test data retrieval from NIST."""
43+
44+ data = {}
45+ data ["temperature" ], data ["mu-mu_0K" ] = OxygenEvolution ().get_chempot_temp_data ()
46+ assert DEFAULT_CACHE_FILE .exists ()
47+ assert all (
48+ np .allclose (data [k ],v ) for k , v in NIST_JANAF_O2_MU_T .items ()
49+ )
50+ json_data = json .loads (DEFAULT_CACHE_FILE .read_text ())
51+ assert all (
52+ np .allclose (json_data [k ],v ) for k , v in NIST_JANAF_O2_MU_T .items ()
53+ )
54+
4055
4156def test_oxy_evo ():
4257 """Very fake Al-O chemical system for testing purposes."""
You can’t perform that action at this time.
0 commit comments