|
2 | 2 |
|
3 | 3 | import numpy as np |
4 | 4 | import pytest |
| 5 | +from packaging import version |
| 6 | +from scipy import __version__ as scipy_version |
5 | 7 |
|
6 | 8 | from squlearn import Executor |
7 | 9 | from squlearn.observables import SummedPaulis, SinglePauli |
@@ -147,8 +149,19 @@ def _build_qnn_setup(self, pqc, ob, test_case: str): |
147 | 149 | def test_zero_param_ob(self, test_case): |
148 | 150 | """Test for zero number of parameters in observable.""" |
149 | 151 |
|
| 152 | + # scipy changed their slsqp implementation in 1.16.0 and we don't want to limit the user to |
| 153 | + # a specific scipy |
| 154 | + if version.parse(scipy_version) < version.parse("1.16.0"): |
| 155 | + regressor_result = np.array( |
| 156 | + [0.11503425, 0.10989764, 0.11377155, 0.12618358, 0.14544058] |
| 157 | + ) |
| 158 | + else: |
| 159 | + regressor_result = np.array( |
| 160 | + [0.11080395, 0.10440662, 0.10877287, 0.12350483, 0.14668292] |
| 161 | + ) |
| 162 | + |
150 | 163 | assert_dict = { |
151 | | - "QNNRegressor": np.array([0.11080395, 0.10440662, 0.10877287, 0.12350483, 0.14668292]), |
| 164 | + "QNNRegressor": regressor_result, |
152 | 165 | "QNNClassifier": np.array([0, 0, 0, 0, 0]), |
153 | 166 | } |
154 | 167 | pqc = ChebyshevPQC(2, 1, 1) |
|
0 commit comments