Skip to content

Commit 9a863e6

Browse files
patch tests
1 parent cc0632f commit 9a863e6

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

mp_api/client/mprester.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,7 @@ def get_entries_in_chemsys(
10931093

10941094
if additional_criteria is None:
10951095
warnings.warn(
1096-
"The default thermo type in retrieving entries has been changed from "
1096+
"The default thermo type when retrieving entries has been changed from "
10971097
"the mixed/corrected PBE GGA and GGA+U hull (`thermo_type = GGA_GGA+U`) "
10981098
"to the joint PBE GGA / GGA+U / r2SCAN hull (`thermo_type = GGA_GGA+U_R2SCAN`). "
10991099
"To use the older behavior, call `get_entries_in_chemsys` with "

tests/client/test_mprester.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,10 @@ def test_get_entries(self, mpr):
260260
def test_get_entries_in_chemsys(self, mpr):
261261
syms = ["Li", "Fe", "O"]
262262
syms2 = "Li-Fe-O"
263-
entries = mpr.get_entries_in_chemsys(syms)
263+
with pytest.warns(
264+
MPRestWarning, match="The default thermo type when retrieving entries"
265+
):
266+
entries = mpr.get_entries_in_chemsys(syms)
264267
entries2 = mpr.get_entries_in_chemsys(syms2)
265268
elements = {Element(sym) for sym in syms}
266269
for e in entries:
@@ -325,7 +328,9 @@ def test_get_pourbaix_entries(self, mpr):
325328
reason="`pip install mpcontribs-client` to use pourbaix functionality.",
326329
)
327330
def test_get_ion_entries(self, mpr):
328-
entries = mpr.get_entries_in_chemsys("Ti-O-H")
331+
entries = mpr.get_entries_in_chemsys(
332+
"Ti-O-H", additional_criteria={"thermo_types": ["GGA_GGA+U"]}
333+
)
329334
pd = PhaseDiagram(entries)
330335
ion_entry_data = mpr.get_ion_reference_data_for_chemsys("Ti-O-H")
331336
ion_entries = mpr.get_ion_entries(pd, ion_entry_data)
@@ -337,7 +342,9 @@ def test_get_ion_entries(self, mpr):
337342
assert len(bi_v_entry_data) == len(bi_data + v_data)
338343

339344
# test an incomplete phase diagram
340-
entries = mpr.get_entries_in_chemsys("Ti-O")
345+
entries = mpr.get_entries_in_chemsys(
346+
"Ti-O", additional_criteria={"thermo_types": ["GGA_GGA+U"]}
347+
)
341348
pd = PhaseDiagram(entries)
342349
with pytest.raises(ValueError, match="The phase diagram chemical system"):
343350
mpr.get_ion_entries(pd)
@@ -351,7 +358,8 @@ def test_get_ion_entries(self, mpr):
351358
itertools.chain.from_iterable(i.elements for i in ion_ref_comps)
352359
)
353360
ion_ref_entries = mpr.get_entries_in_chemsys(
354-
[*map(str, ion_ref_elts), "O", "H"]
361+
[*map(str, ion_ref_elts), "O", "H"],
362+
additional_criteria={"thermo_types": ["GGA_GGA+U"]},
355363
)
356364
mpc = MaterialsProjectAqueousCompatibility()
357365
ion_ref_entries = mpc.process_entries(ion_ref_entries)

0 commit comments

Comments
 (0)