Skip to content

Commit

Permalink
enhance test for from_dict consistency check
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielYang59 committed Oct 19, 2024
1 parent f30e740 commit 259124d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/io/vasp/test_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,17 +698,18 @@ def test_from_file_and_from_dict(self):
"""
Init from file (from str) should yield the same results as from dict.
Setter method should capitalize string keys ("GGA" in this case),
and cast known keys to expected type ("ENCUT" should be float).
Previously init Incar from dict would bypass the proc_val method for
float/int, and might yield values in wrong type.
"""
# Init from dict
incar_dict = {"ENCUT": 500, "GGA": "PS"}
incar_dict = {"ENCUT": 500, "GGA": "PS", "NELM": 60.0}
incar_from_dict = Incar(incar_dict)

# Init from file (from string)
incar_str = """\
ENCUT = 500
GGA = PS
NELM = 60
"""

with ScratchDir("."):
Expand Down Expand Up @@ -872,11 +873,11 @@ def test_check_params(self):
incar.check_params()

assert record[0].message.args[0] == "Cannot find NBAND in the list of INCAR tags"
assert record[1].message.args[0] == "METAGGA: Cannot find SCAM in the list of values"
assert record[1].message.args[0] == "METAGGA: Cannot find Scam in the list of values"
assert record[2].message.args[0] == "EDIFF: (5+1j) is not a float"
assert record[3].message.args[0] == "ISIF: Cannot find 9 in the list of values"
assert record[4].message.args[0] == "LASPH: 5 is not a bool"
assert record[5].message.args[0] == "PHON_TLIST: is_a_str is not a list"
assert record[5].message.args[0] == "PHON_TLIST: Is_a_str is not a list"


class TestKpointsSupportedModes:
Expand Down

0 comments on commit 259124d

Please sign in to comment.