|
1 | 1 | import os
|
2 | 2 | import sys
|
| 3 | +from packaging import version |
3 | 4 |
|
4 |
| -from numpy.lib.arraysetops import isin |
5 | 5 | sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
6 | 6 |
|
7 | 7 |
|
@@ -183,12 +183,19 @@ def test_ndarray_methods():
|
183 | 183 | assert (r == ra).all()
|
184 | 184 |
|
185 | 185 | def test_outputs_formats():
|
| 186 | + |
186 | 187 | values = [[1, 2, 3], [-1, 0, 1]]
|
187 | 188 | w = Fxp(values, True, 16, 8)
|
188 | 189 | like_ref = Fxp(None, True, 24, 12)
|
189 | 190 | out_ref = Fxp(None, True, 24, 8)
|
190 | 191 |
|
191 |
| - z = np.add(w, 2, out_like=like_ref) |
| 192 | + if version.parse(np.__version__) >= version.parse('1.21'): |
| 193 | + # since numpy 1.21 unknown arguments raise an error |
| 194 | + # by now only test the fxpmath.functions.add instead of numpy dispatched add function |
| 195 | + from fxpmath.functions import add |
| 196 | + z = add(w, 2, out_like=like_ref) |
| 197 | + else: |
| 198 | + z = np.add(w, 2, out_like=like_ref) |
192 | 199 |
|
193 | 200 | assert isinstance(z, Fxp)
|
194 | 201 | assert z.n_frac == like_ref.n_frac
|
|
0 commit comments