Skip to content

Commit 3be22d0

Browse files
DanielYang59shyuep
andauthored
Replace some deprecated API (#4228)
* TO BE REVERTED: mark spglib deprecation as error * filter known deprecation warning * replace some deprecated API * revert debug filter * set deprecation warning as error * MaterialsProjectCompatibility -> MaterialsProject2020Compatibility * remove non-existent arg * filter known warning * fix grammar * revert warning filter --------- Co-authored-by: Shyue Ping Ong <[email protected]>
1 parent 5937743 commit 3be22d0

File tree

7 files changed

+9
-8
lines changed

7 files changed

+9
-8
lines changed

src/pymatgen/command_line/critic2_caller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ def get_volume_and_charge(nonequiv_idx):
766766
def _parse_stdout(self, stdout):
767767
warnings.warn(
768768
"Parsing critic2 standard output is deprecated and will not be maintained, "
769-
"please use the native JSON output in future.",
769+
"please use the native JSON output in the future.",
770770
DeprecationWarning,
771771
stacklevel=2,
772772
)

src/pymatgen/entries/compatibility.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,6 @@ def __init__(
913913
correct_peroxide: Specify whether peroxide/superoxide/ozonide
914914
corrections are to be applied or not.
915915
check_potcar_hash (bool): Use potcar hash to verify potcars are correct.
916-
silence_deprecation (bool): Silence deprecation warning. Defaults to False.
917916
"""
918917
self.compat_type = compat_type
919918
self.correct_peroxide = correct_peroxide

src/pymatgen/io/feff/inputs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ def __init__(
190190
self.periodic = True
191191
sym = SpacegroupAnalyzer(struct, **self.spacegroup_analyzer_settings)
192192
data = sym.get_symmetry_dataset()
193-
self.space_number = data.get("number")
194-
self.space_group = data.get("international")
193+
self.space_number = data.number
194+
self.space_group = data.international
195195
# for Molecule, skip the symmetry check
196196
elif isinstance(self.struct, Molecule):
197197
self.periodic = False

tests/electronic_structure/test_boltztrap2.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ def test_get_volume(self):
8080
assert self.loader.get_volume() == approx(477.6256714925874, abs=1e-5)
8181

8282

83+
@pytest.mark.filterwarnings("ignore:BandstructureLoader is deprecated:DeprecationWarning")
8384
class TestBandstructureLoader(TestCase):
8485
def setUp(self):
8586
self.loader = BandstructureLoader(BAND_STRUCT, VASP_RUN.structures[-1])
@@ -107,6 +108,7 @@ def test_set_upper_lower_bands(self):
107108
assert self.loader_sp_dn.ebands.shape == (14, 198)
108109

109110

111+
@pytest.mark.filterwarnings("ignore:VasprunLoader is deprecated:DeprecationWarning")
110112
class TestVasprunLoader(TestCase):
111113
def setUp(self):
112114
self.loader = VasprunLoader(VASP_RUN)

tests/entries/test_computed_entries.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,11 +470,11 @@ def setUp(self):
470470
for temp in self.temps
471471
}
472472

473-
with open(f"{TEST_DIR}/Mn-O_entries.json") as file:
474-
data = json.load(file)
475473
with open(f"{TEST_DIR}/structure_CO2.json") as file:
476474
self.co2_struct = MontyDecoder().process_decoded(json.load(file))
477475

476+
with open(f"{TEST_DIR}/Mn-O_entries.json") as file:
477+
data = json.load(file)
478478
self.mp_entries = [MontyDecoder().process_decoded(d) for d in data]
479479

480480
def test_gf_sisso(self):

tests/ext/test_matproj.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ def test_parity_with_mp_api(self):
908908
pytest.skip("mp_api.client.MPRester cannot be imported for this test.")
909909
mpr_mp_api = MpApi(PMG_MAPI_KEY)
910910
# Test summary
911-
mp_data = mpr_mp_api.summary.search(formula="Al2O3")
911+
mp_data = mpr_mp_api.materials.search(formula="Al2O3")
912912
pmg_data = self.rester.get_summary({"formula": "Al2O3"})
913913
assert len(mp_data) == len(pmg_data)
914914

tests/files/entries/Mn-O_entries.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)