Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/py/mat3ra/mode/methods/pseudopotential.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

from mat3ra.esse.models.methods_directory.legacy.pseudopotential import LegacyMethodPseudopotential

from ..method import Method
from ..method import Method, MethodData


class PseudopotentialMethod(LegacyMethodPseudopotential, Method):
data: MethodData = MethodData()
pseudopotential_cls: Optional[type] = None

@property
Expand All @@ -32,8 +33,6 @@ def to_dict(self, exclude: Optional[List[str]] = None) -> Dict[str, Any]:
json_data = super().to_dict(exclude=exclude)

if exclude is None or "data" not in exclude:
filtered_data = self.data.copy()
# filtered_data.pop("allPseudo", None)
json_data["data"] = filtered_data
json_data["data"] = self.data.to_dict(exclude={"allPseudo"})

return json_data
3 changes: 1 addition & 2 deletions tests/py/unit/test_pseudopotential_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,12 @@ def test_all_pseudo_property(config):
assert isinstance(all_pseudo, list)
assert len(all_pseudo) == 2

@pytest.mark.skip(reason="TODO: fix this test")
@pytest.mark.parametrize("config", TEST_CONFIGS)
def test_to_dict_excludes_all_pseudo(config):
config_with_data = {**config, "data": TEST_COMBINED_PSEUDO_DATA}
method = PseudopotentialMethod.create(config_with_data)

json_data = method.model_dump()
json_data = method.to_dict()
assert "allPseudo" not in json_data["data"]
assert "pseudo" in json_data["data"]

Loading