From 8a04f7f7cd9526cc1112bf00da1050766fab92d5 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Mon, 11 Dec 2023 08:39:42 +0100 Subject: [PATCH] test --- python/tests/test_de_model.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 python/tests/test_de_model.py diff --git a/python/tests/test_de_model.py b/python/tests/test_de_model.py new file mode 100644 index 0000000000..7dec534da9 --- /dev/null +++ b/python/tests/test_de_model.py @@ -0,0 +1,35 @@ +import sympy as sp +from amici.de_model import Event +from amici.import_utils import amici_time_symbol + + +def test_event_trigger_time(): + e = Event( + sp.Symbol("event1"), "event name", amici_time_symbol - 10, sp.Float(0) + ) + assert e.triggers_at_fixed_timepoint() is True + assert e.get_trigger_time() == 10 + + # fixed, but multiple timepoints - not (yet) supported + e = Event( + sp.Symbol("event1"), + "event name", + sp.sin(amici_time_symbol), + sp.Float(0), + ) + assert e.triggers_at_fixed_timepoint() is False + + e = Event( + sp.Symbol("event1"), "event name", amici_time_symbol / 2, sp.Float(0) + ) + assert e.triggers_at_fixed_timepoint() is True + assert e.get_trigger_time() == 0 + + # parameter-dependent triggers - not (yet) supported + e = Event( + sp.Symbol("event1"), + "event name", + amici_time_symbol - sp.Symbol("delay"), + sp.Float(0), + ) + assert e.triggers_at_fixed_timepoint() is False