File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222from pymatgen .symmetry .analyzer import SpacegroupAnalyzer
2323from requests import Session , get
2424
25- from mp_api .client .core import BaseRester , MPRestError
25+ from mp_api .client .core import BaseRester , MPRestError , MPRestWarning
2626from mp_api .client .core ._oxygen_evolution import OxygenEvolution
2727from mp_api .client .core .settings import MAPIClientSettings
2828from mp_api .client .core .utils import load_json , validate_api_key , validate_ids
@@ -213,7 +213,9 @@ def __init__(
213213 if "monty_decode" in kwargs :
214214 warnings .warn (
215215 "Ignoring `monty_decode`, as it is no longer a supported option in `mp_api`."
216- "The client by default returns results consistent with `monty_decode=True`."
216+ "The client by default returns results consistent with `monty_decode=True`." ,
217+ stacklevel = 2 ,
218+ category = MPRestWarning ,
217219 )
218220
219221 # Check if emmet version of server is compatible
Original file line number Diff line number Diff line change 3333from pymatgen .io .vasp import Chgcar
3434
3535from mp_api .client import MPRester
36- from mp_api .client .core . exceptions import MPRestError
36+ from mp_api .client .core import MPRestError , MPRestWarning
3737from mp_api .client .core .settings import MAPIClientSettings
3838
3939from .conftest import requires_api_key
@@ -575,3 +575,7 @@ def test_oxygen_evolution_bad_input(self, mpr):
575575
576576 with pytest .raises (ValueError , match = "No available insertion electrode data" ):
577577 _ = mpr .get_oxygen_evolution ("mp-2207" , "Al" )
578+
579+ def test_monty_decode_warning (self ):
580+ with pytest .warns (MPRestWarning , match = "Ignoring `monty_decode`" ):
581+ MPRester (monty_decode = False )
You can’t perform that action at this time.
0 commit comments