|
2 | 2 |
|
3 | 3 | import numpy as np
|
4 | 4 | from numpy import array
|
5 |
| -from numpy.testing import suppress_warnings |
| 5 | +from numpy.testing import suppress_warnings |
6 | 6 | import pytest
|
7 | 7 | from pytest import raises as assert_raises
|
8 | 8 |
|
@@ -187,9 +187,9 @@ def test_correctness(self, xp):
|
187 | 187 | BW_3dB = 2*np.argmax(spec <= -3.0102999566398121) / N_fft * M_win
|
188 | 188 | BW_18dB = 2*np.argmax(spec <= -18.061799739838872) / N_fft * M_win
|
189 | 189 |
|
190 |
| - xp_assert_close(PSLL, -35.1672, atol=1) |
191 |
| - xp_assert_close(BW_3dB, 1.1822, atol=0.1) |
192 |
| - xp_assert_close(BW_18dB, 2.6112, atol=0.1) |
| 190 | + assert math.isclose(PSLL, -35.1672, abs_tol=1) |
| 191 | + assert math.isclose(BW_3dB, 1.1822, abs_tol=0.1) |
| 192 | + assert math.isclose(BW_18dB, 2.6112, abs_tol=0.1) |
193 | 193 |
|
194 | 194 |
|
195 | 195 | class TestBohman:
|
@@ -763,8 +763,8 @@ def test_basic(self, xp):
|
763 | 763 |
|
764 | 764 | def test_array_size(self, xp):
|
765 | 765 | for n in [0, 10, 11]:
|
766 |
| - xp_assert_equal(windows.lanczos(n, sym=False, xp=xp).shape[0], n) |
767 |
| - xp_assert_equal(windows.lanczos(n, sym=True, xp=xp).shape[0], n) |
| 766 | + assert windows.lanczos(n, sym=False, xp=xp).shape[0] == n |
| 767 | + assert windows.lanczos(n, sym=True, xp=xp).shape[0] == n |
768 | 768 |
|
769 | 769 |
|
770 | 770 | class TestGetWindow:
|
@@ -822,11 +822,11 @@ def test_array_as_window(self, xp):
|
822 | 822 | resample(sig, len(sig) * osfactor, window=win)
|
823 | 823 |
|
824 | 824 | def test_general_cosine(self, xp):
|
825 |
| - xp_assert_close(get_window(('general_cosine', [0.5, 0.3, 0.2]), 4), |
826 |
| - [0.4, 0.3, 1, 0.3]) |
827 |
| - xp_assert_close(get_window(('general_cosine', [0.5, 0.3, 0.2]), 4, |
| 825 | + xp_assert_close(get_window(('general_cosine', xp.asarray([0.5, 0.3, 0.2])), 4), |
| 826 | + xp.asarray([0.4, 0.3, 1, 0.3], dtype=xp.float64)) |
| 827 | + xp_assert_close(get_window(('general_cosine', xp.asarray([0.5, 0.3, 0.2])), 4, |
828 | 828 | fftbins=False),
|
829 |
| - [0.4, 0.55, 0.55, 0.4]) |
| 829 | + xp.asarray([0.4, 0.55, 0.55, 0.4], dtype=xp.float64)) |
830 | 830 |
|
831 | 831 | with pytest.raises(ValueError):
|
832 | 832 | get_window(('general_cosine', [0.5, 0.3, 0.2]), 4, xp=xp)
|
@@ -872,10 +872,10 @@ def test_windowfunc_basics(xp):
|
872 | 872 | xp_assert_close(w1[:-1], w2)
|
873 | 873 |
|
874 | 874 | # Check that functions run and output lengths are correct
|
875 |
| - xp_assert_equal(window(6, *params, sym=True, xp=xp).shape[0], 6) |
876 |
| - xp_assert_equal(window(6, *params, sym=False, xp=xp).shape[0], 6) |
877 |
| - xp_assert_equal(window(7, *params, sym=True, xp=xp).shape[0], 7) |
878 |
| - xp_assert_equal(window(7, *params, sym=False, xp=xp).shape[0], 7) |
| 875 | + assert window(6, *params, sym=True, xp=xp).shape[0] == 6 |
| 876 | + assert window(6, *params, sym=False, xp=xp).shape[0] == 6 |
| 877 | + assert window(7, *params, sym=True, xp=xp).shape[0] == 7 |
| 878 | + assert window(7, *params, sym=False, xp=xp).shape[0] == 7 |
879 | 879 |
|
880 | 880 | # Check invalid lengths
|
881 | 881 | assert_raises(ValueError, window, 5.5, *params, xp=xp)
|
@@ -953,7 +953,7 @@ def test_not_needs_params(xp, winstr):
|
953 | 953 | if is_jax(xp) and winstr in ['taylor']:
|
954 | 954 | pytest.skip(reason=f'{winstr}: item assignment')
|
955 | 955 | win = get_window(winstr, 7, xp=xp)
|
956 |
| - xp_assert_equal(win.shape[0], 7) |
| 956 | + assert win.shape[0] == 7 |
957 | 957 |
|
958 | 958 |
|
959 | 959 | def test_symmetric(xp):
|
|
0 commit comments