Skip to content

Commit

Permalink
add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
PythonFZ committed Dec 6, 2024
1 parent 1aa85f8 commit 038364b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_single_obs_key.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from ase.build import molecule
import znh5md

def test_single_obs_key_info(tmp_path):
# Test a special case where only the first config has the key
# which caused an error in the past
io = znh5md.IO(tmp_path / "test.h5")
water = molecule("H2O")
water.info["density"] = 0.997
io.append(water)
del water.info["density"]
io.extend([water for _ in range(5)])
assert len(io) == 6
assert len(io[:]) == 6
assert len(list(io)) == 6

0 comments on commit 038364b

Please sign in to comment.