Skip to content

Commit 2b16e4e

Browse files
patch tests to reflect mprestwarning
1 parent ba9a27e commit 2b16e4e

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

tests/client/core/test_oxygen_evolution.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from pymatgen.core import Composition
1010
from pymatgen.entries.computed_entries import ComputedEntry
1111

12+
from mp_api.client.core.exceptions import MPRestWarning
1213
from mp_api.client.core._oxygen_evolution import (
1314
DEFAULT_CACHE_FILE,
1415
NIST_JANAF_O2_MU_T,
@@ -39,7 +40,7 @@ def test_interp():
3940

4041
# ensure user is warned when data is outside fit range
4142
for badval in (1.0, -50.0):
42-
with pytest.warns(UserWarning, match="outside the fitting range"):
43+
with pytest.warns(MPRestWarning, match="outside the fitting range"):
4344
oxyevo.mu_to_temp_spline(badval)
4445

4546

tests/client/molecules/test_jcesr.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import pytest
55
from pymatgen.core.periodic_table import Element
66

7+
from mp_api.client.core.exceptions import MPRestWarning
78
from mp_api.client.routes.molecules.jcesr import JcesrMoleculesRester
89

910
from ..conftest import requires_api_key
@@ -51,5 +52,5 @@ def test_client(rester):
5152

5253

5354
def test_warning():
54-
with pytest.warns(UserWarning, match="unmaintained legacy molecules"):
55+
with pytest.warns(MPRestWarning, match="unmaintained legacy molecules"):
5556
JcesrMoleculesRester()

tests/client/test_mprester.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def test_get_entries(self, mpr):
165165
syms = ["Li", "Fe", "O"]
166166
chemsys = "Li-Fe-O"
167167
with pytest.warns(
168-
UserWarning, match="The `inc_structure` argument is deprecated"
168+
DeprecationWarning, match="The `inc_structure` argument is deprecated"
169169
):
170170
entries = mpr.get_entries(chemsys, inc_structure=False)
171171

@@ -558,7 +558,9 @@ def test_get_stability(self, chemsys, thermo_type):
558558
]
559559

560560
if no_compound_entries:
561-
with pytest.warns(UserWarning, match="No phase diagram data available"):
561+
with pytest.warns(
562+
MPRestWarning, match="No phase diagram data available"
563+
):
562564
mpr.get_stability(modified_entries, thermo_type=thermo_type)
563565
return
564566

0 commit comments

Comments
 (0)