From d98031b4d8d58b64d2158321fd9110bde6611df5 Mon Sep 17 00:00:00 2001 From: kberket Date: Tue, 9 Sep 2025 16:31:36 -0700 Subject: [PATCH 1/5] removing material_ids from electrode rester --- mp_api/client/routes/materials/electrodes.py | 9 --------- tests/materials/test_electrodes.py | 1 - 2 files changed, 10 deletions(-) diff --git a/mp_api/client/routes/materials/electrodes.py b/mp_api/client/routes/materials/electrodes.py index e2555ac06..4738b3ea5 100644 --- a/mp_api/client/routes/materials/electrodes.py +++ b/mp_api/client/routes/materials/electrodes.py @@ -16,7 +16,6 @@ class ElectrodeRester(BaseRester[InsertionElectrodeDoc]): def search( # pragma: ignore self, - material_ids: str | list[str] | None = None, battery_ids: str | list[str] | None = None, average_voltage: tuple[float, float] | None = None, capacity_grav: tuple[float, float] | None = None, @@ -43,8 +42,6 @@ def search( # pragma: ignore """Query using a variety of search criteria. Arguments: - material_ids (str, List[str]): A single Material ID string or list of strings - (e.g., mp-149, [mp-149, mp-13]). battery_ids (str, List[str]): A single battery ID string or list of strings (e.g., mp-22526_Li, [mp-22526_Li, mp-22526_Ca]). average_voltage (Tuple[float,float]): Minimum and maximum value of the average voltage for a particular @@ -85,12 +82,6 @@ def search( # pragma: ignore """ query_params = defaultdict(dict) # type: dict - if material_ids: - if isinstance(material_ids, str): - material_ids = [material_ids] - - query_params.update({"material_ids": ",".join(validate_ids(material_ids))}) - if battery_ids: if isinstance(battery_ids, str): battery_ids = [battery_ids] diff --git a/tests/materials/test_electrodes.py b/tests/materials/test_electrodes.py index 14b28f684..e4541af79 100644 --- a/tests/materials/test_electrodes.py +++ b/tests/materials/test_electrodes.py @@ -33,7 +33,6 @@ def rester(): } # type: dict custom_field_tests = { - "material_ids": ["mp-16722"], "battery_ids": ["mp-16722_Al"], "working_ion": Element("Li"), "formula": "CoO2", From 8b38e268e18124b17a3cf009e41b06bffc7e4fcf Mon Sep 17 00:00:00 2001 From: kberket Date: Tue, 9 Sep 2025 16:32:23 -0700 Subject: [PATCH 2/5] re-enable large result set robocrys test --- tests/materials/test_robocrys.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/materials/test_robocrys.py b/tests/materials/test_robocrys.py index 2b04436a1..74abb4628 100644 --- a/tests/materials/test_robocrys.py +++ b/tests/materials/test_robocrys.py @@ -25,9 +25,7 @@ def test_client(rester): assert doc.condensed_structure is not None -# TODO: switch this to the skipif once emmet PR 1261 is deployed to production -# @pytest.mark.skipif(os.getenv("MP_API_KEY", None) is None, reason="No API key found.") -@pytest.mark.skip(reason="Query with large result set fails with faceted pipeline") +@pytest.mark.skipif(os.getenv("MP_API_KEY", None) is None, reason="No API key found.") def test_client_large_result_set(rester): search_method = rester.search From 82225b20534769377e937ea014f27aa1eb5b17de Mon Sep 17 00:00:00 2001 From: kberket Date: Tue, 9 Sep 2025 16:33:11 -0700 Subject: [PATCH 3/5] skipping tasks client test due to timeout --- tests/test_client.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_client.py b/tests/test_client.py index 4001b0234..0f4e77f0f 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -36,6 +36,7 @@ # "tasks", # "bonds", "materials_xas", + "materials_tasks", "materials_elasticity", "materials_fermi", "materials_alloys", @@ -81,4 +82,5 @@ def test_generic_get_methods(rester): elif name not in special_resters: doc = rester.get_data_by_id(key_only_resters[name], fields=[key]) + print(doc.model_dump()) assert isinstance(doc, rester.document_model) From 5f92211e870981863641d0243c2d14301258875e Mon Sep 17 00:00:00 2001 From: kberket Date: Tue, 9 Sep 2025 16:33:39 -0700 Subject: [PATCH 4/5] fixing phonon expected types --- tests/test_mprester.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/test_mprester.py b/tests/test_mprester.py index 7c4127d11..8eb55ef02 100644 --- a/tests/test_mprester.py +++ b/tests/test_mprester.py @@ -27,8 +27,7 @@ from pymatgen.entries.computed_entries import ComputedEntry, GibbsComputedStructureEntry from pymatgen.io.cif import CifParser from pymatgen.io.vasp import Chgcar -from pymatgen.phonon.bandstructure import PhononBandStructureSymmLine -from pymatgen.phonon.dos import PhononDos +from emmet.core.phonon import PhononDOS, PhononBS from mp_api.client import MPRester from mp_api.client.core.client import MPRestError @@ -291,10 +290,10 @@ def test_get_ion_entries(self, mpr): def test_get_phonon_data_by_material_id(self, mpr): bs = mpr.get_phonon_bandstructure_by_material_id("mp-2172") - assert isinstance(bs, PhononBandStructureSymmLine) + assert isinstance(bs, PhononBS) dos = mpr.get_phonon_dos_by_material_id("mp-2172") - assert isinstance(dos, PhononDos) + assert isinstance(dos, PhononDOS) def test_get_charge_density_from_material_id(self, mpr): chgcar = mpr.get_charge_density_from_material_id("mp-149") From 2747d8cb9b7b6b38c6f402cc46cd1fd5c41dd0cc Mon Sep 17 00:00:00 2001 From: Patrick Huck Date: Tue, 9 Sep 2025 17:17:11 -0700 Subject: [PATCH 5/5] rm print --- tests/test_client.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_client.py b/tests/test_client.py index 0f4e77f0f..25bf18124 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -82,5 +82,4 @@ def test_generic_get_methods(rester): elif name not in special_resters: doc = rester.get_data_by_id(key_only_resters[name], fields=[key]) - print(doc.model_dump()) assert isinstance(doc, rester.document_model)