Skip to content

Commit

Permalink
add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielYang59 committed Jan 29, 2025
1 parent 1358181 commit 27f7356
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions tests/analysis/magnetism/test_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def test_missing_spin(self):
class TestMagneticStructureEnumerator:
@pytest.mark.skipif(not enumlib_present, reason="enumlib not present")
def test_ordering_enumeration(self):
# simple afm
# simple AFM
structure = Structure.from_file(f"{TEST_DIR}/LaMnO3.json")
enumerator = MagneticStructureEnumerator(structure)
assert enumerator.input_origin == "afm"
Expand All @@ -277,7 +277,7 @@ def test_ordering_enumeration(self):
enumerator = MagneticStructureEnumerator(structure)
assert enumerator.input_origin == "afm_by_Cr"

# afm requiring large cell size
# AFM requiring large cell size
# (enable for further development of workflow, too slow for CI)

# structure = Structure.from_file(f"{ref_dir}/CuO.json")
Expand All @@ -297,6 +297,19 @@ def test_ordering_enumeration(self):
)
assert enumerator.input_origin == "afm_by_motif_2a"

def test_default_transformation_kwargs(self):
structure = Structure.from_file(f"{TEST_DIR}/LaMnO3.json")

# Make sure user input would not be overwritten by default values
transformation_kwargs = {"timeout": 10, "check_ordered_symmetry": True}
enumerator = MagneticStructureEnumerator(structure, transformation_kwargs=transformation_kwargs)
assert enumerator.transformation_kwargs["timeout"] == 10
assert enumerator.transformation_kwargs["check_ordered_symmetry"] is True

enumerator = MagneticStructureEnumerator(structure, transformation_kwargs={})
assert enumerator.transformation_kwargs["timeout"] == 5
assert enumerator.transformation_kwargs["check_ordered_symmetry"] is False


class TestMagneticDeformation:
def test_magnetic_deformation(self):
Expand Down

0 comments on commit 27f7356

Please sign in to comment.