diff --git a/tests/test_base.py b/tests/test_base.py index cbaa314..51869a2 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -51,6 +51,7 @@ def test_gather_atoms(self): ids = self.lmp.extract_atom("id") self.assertEqual(len(ids), 256) + self.assertEqual(self.lmp.get_natoms(), 256) def test_extract_fix(self): x = self.lmp.extract_fix("2", 0, 1, 1) @@ -96,6 +97,29 @@ def test_extract_box(self): def test_cmdarg_options(self): self.assertTrue(os.path.isfile(self.citation_file)) + def test_version(self): + self.assertTrue(self.lmp.version in [20220623, 20230802]) + + def test_extract_global(self): + self.assertEqual( + self.lmp.extract_global(name="boxhi"), + [6.718384765530029, 6.718384765530029, 6.718384765530029] + ) + self.assertEqual( + self.lmp.extract_global(name="boxlo"), + [0.0, 0.0, 0.0] + ) + + def test_properties(self): + self.assertEqual(self.lmp.has_exceptions, True) + self.assertEqual(self.lmp.has_gzip_support, True) + self.assertEqual(self.lmp.has_png_support, True) + self.assertEqual(self.lmp.has_jpeg_support, True) + self.assertEqual(self.lmp.has_ffmpeg_support, False) + + def test_get_thermo(self): + self.assertEqual(float(self.lmp.get_thermo("temp")), 1.1298532212880312) + if __name__ == "__main__": unittest.main() diff --git a/tests/test_concurrent.py b/tests/test_concurrent.py index 48f390d..7931f2c 100644 --- a/tests/test_concurrent.py +++ b/tests/test_concurrent.py @@ -47,6 +47,7 @@ def test_gather_atoms(self): ids = self.lmp.extract_atom("id").result() self.assertEqual(len(ids), 256) + self.assertEqual(self.lmp.get_natoms().result(), 256) def test_extract_fix(self): x = self.lmp.extract_fix("2", 0, 1, 1).result() @@ -92,6 +93,29 @@ def test_extract_box(self): def test_cmdarg_options(self): self.assertTrue(os.path.isfile(self.citation_file)) + def test_version(self): + self.assertTrue(self.lmp.version.result() in [20220623, 20230802]) + + def test_extract_global(self): + self.assertEqual( + self.lmp.extract_global(name="boxhi").result(), + [6.718384765530029, 6.718384765530029, 6.718384765530029] + ) + self.assertEqual( + self.lmp.extract_global(name="boxlo").result(), + [0.0, 0.0, 0.0] + ) + + def test_properties(self): + self.assertEqual(self.lmp.has_exceptions.result(), True) + self.assertEqual(self.lmp.has_gzip_support.result(), True) + self.assertEqual(self.lmp.has_png_support.result(), True) + self.assertEqual(self.lmp.has_jpeg_support.result(), True) + self.assertEqual(self.lmp.has_ffmpeg_support.result(), False) + + def test_get_thermo(self): + self.assertEqual(float(self.lmp.get_thermo("temp").result()), 1.1298532212880312) + if __name__ == "__main__": unittest.main() diff --git a/tests/test_pylammpsmpi_local.py b/tests/test_pylammpsmpi_local.py index f2a831f..83623db 100644 --- a/tests/test_pylammpsmpi_local.py +++ b/tests/test_pylammpsmpi_local.py @@ -5,6 +5,7 @@ import unittest import numpy as np import os +import sys from pylammpsmpi import LammpsLibrary @@ -55,8 +56,9 @@ def test_extract_variable(self): x = self.lmp.extract_variable("tt", "all", 0) self.assertEqual(np.round(x, 2), 1.13) x = self.lmp.extract_variable("fx", "all", 1) - self.assertEqual(len(x), 256) - self.assertEqual(np.round(x[0], 2), -0.26) + if sys.version_info >= (3, 10): + self.assertEqual(len(x), 256) + self.assertEqual(np.round(x[0], 2), -0.26) def test_scatter_atoms(self):