From 84903daa1e609d4a67665bb62fb6afe44c9ba149 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Schm=C3=B6lder?= Date: Sat, 22 Mar 2025 09:08:09 +0100 Subject: [PATCH 1/2] Add missing import --- tests/test_parallelization.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_parallelization.py b/tests/test_parallelization.py index 378026e..1341dbb 100644 --- a/tests/test_parallelization.py +++ b/tests/test_parallelization.py @@ -1,6 +1,7 @@ from cadet import Cadet from joblib import Parallel, delayed -from .test_dll import setup_model +import pytest +from tests.test_dll import setup_model n_jobs = 2 From 2b7f95b17170a7ad68fe4deb507e0397f9df4069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Schm=C3=B6lder?= Date: Sat, 22 Mar 2025 09:08:26 +0100 Subject: [PATCH 2/2] Add version property --- cadet/cadet.py | 5 +++++ tests/test_cadet.py | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 tests/test_cadet.py diff --git a/cadet/cadet.py b/cadet/cadet.py index bc7607e..a8e3a22 100644 --- a/cadet/cadet.py +++ b/cadet/cadet.py @@ -375,6 +375,11 @@ def autodetect_cadet() -> Optional[Path]: return cadet_root + @property + def version(self) -> str: + """str: The version of the CADET-Core installation.""" + return self.cadet_runner.cadet_version + @property def cadet_runner(self) -> CadetRunnerBase: """ diff --git a/tests/test_cadet.py b/tests/test_cadet.py new file mode 100644 index 0000000..f01cd50 --- /dev/null +++ b/tests/test_cadet.py @@ -0,0 +1,20 @@ +""" +Test general properties of Cadet. +""" + + +import re +import pytest +from cadet import Cadet + + +@pytest.mark.parametrize("use_dll", [True, False]) +def test_version(use_dll): + # Assuming Cadet has a method to set or configure the use of DLL + cadet = Cadet(use_dll=use_dll) + + assert re.match(r"\d\.\d\.\d", cadet.version), "Version format should be X.X.X" + + +if __name__ == '__main__': + pytest.main([__file__])