Skip to content

Commit

Permalink
add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielYang59 committed Feb 27, 2025
1 parent 50b5df3 commit 49c3078
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions tests/symmetry/test_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from pymatgen.analysis.structure_analyzer import SpacegroupAnalyzer
from pymatgen.core import Lattice, Structure
from pymatgen.symmetry.structure import SymmetrizedStructure
from pymatgen.util.testing import PymatgenTest


Expand All @@ -15,8 +16,20 @@ def setUp(self):

self.symm_structure = SpacegroupAnalyzer(self.structure).get_symmetrized_structure()

def test_as_dict(self):
self.assert_msonable(self.symm_structure)
def test_str_repr(self):
assert str(self.symm_structure) == repr(self.symm_structure)
assert "Reduced Formula: Fe" in str(self.symm_structure)

def test_dict(self):
dct = self.symm_structure.as_dict()

assert isinstance(SymmetrizedStructure.from_dict(dct), SymmetrizedStructure)

def test_serialize(self):
self.assert_msonable(self.symm_structure)

self.symm_structure.to(fmt="json")

def test_find_equivalent_sites(self):
site = self.symm_structure.sites[0]
assert self.symm_structure.find_equivalent_sites(site) == self.symm_structure.sites

0 comments on commit 49c3078

Please sign in to comment.