Skip to content

Commit

Permalink
relocate |= test case
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielYang59 committed May 31, 2024
1 parent a2678bf commit 1dc2ed8
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions tests/io/lobster/test_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1625,14 +1625,6 @@ def test_magic_methods(self):

assert "helloworld" not in self.Lobsterin

def test_update(self):
"""Test case sensitivity of update operation."""
self.Lobsterin |= {"skipCOHP": True} # Camel case
assert self.Lobsterin["skipcohp"] is True

self.Lobsterin |= {"skipcohp": False} # lower case
assert self.Lobsterin["skipcohp"] is False

def test_initialize_from_dict(self):
# initialize from dict
lobsterin = Lobsterin(
Expand Down Expand Up @@ -1817,6 +1809,7 @@ def test_dict_functionality(self):
for key in ("COHPstartEnergy", "COHPstartEnergy", "COhPstartenergy"):
start_energy = self.Lobsterin.get(key)
assert start_energy == -15.0, f"{start_energy=}, {key=}"

lobsterin_copy = self.Lobsterin.copy()
lobsterin_copy.update({"cohpstarteNergy": -10.00})
assert lobsterin_copy["cohpstartenergy"] == -10.0
Expand All @@ -1827,10 +1820,18 @@ def test_dict_functionality(self):
assert lobsterin_copy["cohpsteps"] == 100
len_before = len(lobsterin_copy.items())
assert len_before == 9, f"{len_before=}"

lobsterin_copy.popitem()
len_after = len(lobsterin_copy.items())
assert len_after == len_before - 1

# Test case sensitivity of |= operator
self.Lobsterin |= {"skipCOHP": True} # Camel case
assert self.Lobsterin["skipcohp"] is True

self.Lobsterin |= {"skipcohp": False} # lower case
assert self.Lobsterin["skipcohp"] is False

def test_read_write_lobsterin(self):
outfile_path = tempfile.mkstemp()[1]
lobsterin1 = Lobsterin.from_file(f"{TEST_DIR}/lobsterin.1")
Expand Down

0 comments on commit 1dc2ed8

Please sign in to comment.