From ae1c2ef65e4e572916b1f3aa1f98b65ab49b1693 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Tue, 21 Feb 2023 16:39:26 -0700 Subject: [PATCH 1/2] Add tests for extract_compute() --- tests/test_pylammpsmpi_local.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_pylammpsmpi_local.py b/tests/test_pylammpsmpi_local.py index f4ef06cc..dd73a0f8 100644 --- a/tests/test_pylammpsmpi_local.py +++ b/tests/test_pylammpsmpi_local.py @@ -29,6 +29,14 @@ def test_extract_atom(self): ids = self.lmp.extract_atom("id") self.assertEqual(len(ids), 256) + def test_extract_compute_global(self): + compute_temp = self.lmp.extract_compute("1", 0, 0) + self.assertEqual(len(compute_temp), 1) + + def test_extract_compute_per_atom(self): + compute_ke_atom = self.lmp.extract_compute("ke", 1, 1) + self.assertEqual(len(compute_ke_atom), 256) + def test_gather_atoms(self): f = self.lmp.gather_atoms("f") self.assertEqual(len(f), 256) From c63192673e719073d1e9b15167248b76469ca48f Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Tue, 21 Feb 2023 16:45:14 -0700 Subject: [PATCH 2/2] Update test_pylammpsmpi_local.py --- tests/test_pylammpsmpi_local.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_pylammpsmpi_local.py b/tests/test_pylammpsmpi_local.py index dd73a0f8..e63ad8f1 100644 --- a/tests/test_pylammpsmpi_local.py +++ b/tests/test_pylammpsmpi_local.py @@ -31,7 +31,7 @@ def test_extract_atom(self): def test_extract_compute_global(self): compute_temp = self.lmp.extract_compute("1", 0, 0) - self.assertEqual(len(compute_temp), 1) + self.assertIsInstance(compute_temp, float) def test_extract_compute_per_atom(self): compute_ke_atom = self.lmp.extract_compute("ke", 1, 1)