diff --git a/tests/test_example/test_cli.py b/tests/test_example/test_cli.py index 2b0b30e..eba6a78 100644 --- a/tests/test_example/test_cli.py +++ b/tests/test_example/test_cli.py @@ -28,7 +28,7 @@ def test_all_flags_multiprocess(): def test_a_p_flags(): trajectory = ["tests/test_example/459_02.lammpstrj"] - result_str = "lindemann index per" + result_str = "lindemann_index_per" for flag in [ "-a", "-p", @@ -45,7 +45,7 @@ def test_t_flag(): def test_m_flag(): flag = "-m" - res_str = "memory use: \nFlag -t (per_trj) will use 0.0034 GB\n\nFlag -ot (per_trj) will use 0.0008 GB\nFlag -f (per_frames) will use 0.0034 GB\nFlag -a (per_atoms) will use 0.0058 GB\n" + res_str = "\nFlag -t (per_trj) will use 0.0034 GB\nFlag -ot (per_trj) will use 0.0008 GB\nFlag -f (per_frames) will use 0.0034 GB\nFlag -of (per_frames) will use 0.0008 GB\nFlag -a (per_atoms) will use 0.0058 GB\n" trajectory = ["tests/test_example/459_02.lammpstrj"] single_process_and_multiprocess(trajectory, flag, res_str) diff --git a/tests/test_example/test_numeric.py b/tests/test_example/test_numeric.py index a07a952..96d718c 100644 --- a/tests/test_example/test_numeric.py +++ b/tests/test_example/test_numeric.py @@ -1,7 +1,7 @@ import numpy as np import pytest -from lindemann.index import online_trj, per_atoms, per_frames, per_trj +from lindemann.index import online_frames, online_trj, per_atoms, per_frames, per_trj from lindemann.trajectory import read "Testing the individal parts of the index module, its possible to change the test setup for individual modules" @@ -81,6 +81,42 @@ def test_frames_middle(trajectory): assert np.isclose(linde_at_200_per_frames, linde_from_200_trj) +@pytest.mark.parametrize( + ("trajectory", "lindemannindex"), + [ + ( + "tests/test_example/459_01.lammpstrj", + 0.025923892565654555, + ), + ( + "tests/test_example/459_02.lammpstrj", + 0.026426709832984754, + ), + ], +) +def test_online_frames(trajectory, lindemannindex): + """Example test with parametrization.""" + pipeline, data = read.trajectory(trajectory) + test_array = online_frames.calculate(pipeline, data) + assert np.isclose(test_array[-1], lindemannindex) + + +@pytest.mark.parametrize( + ("trajectory"), + [ + ("tests/test_example/459_01.lammpstrj"), + ("tests/test_example/459_02.lammpstrj"), + ], +) +def test_online_frames_middle(trajectory): + """Example test with parametrization.""" + pipeline, data = read.trajectory(trajectory) + test_array = online_frames.calculate(pipeline, data) + linde_from_200_trj = online_trj.calculate(pipeline, data, 201) + linde_at_200_per_frames = test_array[200] + assert np.isclose(linde_at_200_per_frames, linde_from_200_trj) + + @pytest.mark.parametrize( ("trajectory", "lindemannindex"), [