Skip to content

Commit 48b18f4

Browse files
committed
Monkey-patch version to test compatibility with optimagic
1 parent e9f5798 commit 48b18f4

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

src/tranquilo/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def add_models(model1, model2):
9898
Union[ScalarModel, VectorModel]: The sum of the two models.
9999
100100
"""
101-
if isinstance(model1, type(model2)):
101+
if not isinstance(model1, type(model2)):
102102
raise TypeError("Models must be of the same type.")
103103

104104
if not np.allclose(model1.shift, model2.shift):

tests/conftest.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import optimagic.optimizers.tranquilo as t
2+
from _pytest.monkeypatch import MonkeyPatch
3+
4+
_mp = MonkeyPatch()
5+
6+
7+
def pytest_configure(config):
8+
_mp.setattr(
9+
t, "IS_TRANQUILO_VERSION_NEWER_OR_EQUAL_TO_0_1_0", "patched-value", raising=True
10+
)
11+
12+
13+
def pytest_unconfigure(config):
14+
_mp.undo()

0 commit comments

Comments
 (0)