Skip to content

Commit

Permalink
add exeception test
Browse files Browse the repository at this point in the history
  • Loading branch information
naik-aakash committed Oct 6, 2024
1 parent 85b9739 commit 3130299
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/io/lobster/test_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,11 @@ def test_get_structure_with_charges(self):
s2 = Structure.from_dict(structure_dict2)
assert s2 == self.charge2.get_structure_with_charges(f"{VASP_IN_DIR}/POSCAR_MnO")

def test_exception(self):
structure_file = f"{VASP_IN_DIR}/POSCAR.AlN"
with pytest.raises(ValueError, match="CHARGE.LCFO.lobster charges are not sorted site wise"):
self.charge_lcfo.get_structure_with_charges(structure_filename=structure_file)

def test_msonable(self):
dict_data = self.charge2.as_dict()
charge_from_dict = Charge.from_dict(dict_data)
Expand Down Expand Up @@ -1666,6 +1671,11 @@ def test_structure_with_grosspop(self):
new_structure = self.grosspop1.get_structure_with_total_grosspop(f"{TEST_DIR}/POSCAR.SiO2")
assert_allclose(new_structure.frac_coords, Structure.from_dict(struct_dict).frac_coords)

def test_exception(self):
structure_file = f"{VASP_IN_DIR}/POSCAR.AlN"
with pytest.raises(ValueError, match="The GROSSPOP.LCFO.lobster data is not site wise"):
self.grosspop_511_lcfo.get_structure_with_total_grosspop(structure_filename=structure_file)

def test_msonable(self):
dict_data = self.grosspop1.as_dict()
grosspop_from_dict = Grosspop.from_dict(dict_data)
Expand Down

0 comments on commit 3130299

Please sign in to comment.