Skip to content

Commit

Permalink
fix #99 (add test) (#100)
Browse files Browse the repository at this point in the history
* fix #99 (add test)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
PythonFZ and pre-commit-ci[bot] authored Jul 24, 2024
1 parent c0af154 commit 003f69c
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/test_high_dim_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import numpy as np
import numpy.testing as npt
from ase.build import molecule

import znh5md


def test_high_dim_data_arrays(tmp_path):
water = molecule("H2O")
water.arrays["descriptor"] = np.random.rand(3, 10, 5, 4, 3)

io = znh5md.IO(tmp_path / "test.h5")
io.append(water)

io2 = znh5md.IO(tmp_path / "test.h5")
water2 = io2[0]

npt.assert_array_equal(water.arrays["descriptor"], water2.arrays["descriptor"])


def test_high_dim_data_info(tmp_path):
water = molecule("H2O")
water.info["descriptor"] = np.random.rand(5, 10, 4, 4, 3)

io = znh5md.IO(tmp_path / "test.h5")
io.append(water)

io2 = znh5md.IO(tmp_path / "test.h5")
water2 = io2[0]

npt.assert_array_equal(water.info["descriptor"], water2.info["descriptor"])

0 comments on commit 003f69c

Please sign in to comment.