diff options
| author | Bas van Beek <b.f.van.beek@vu.nl> | 2021-09-30 17:13:32 +0200 |
|---|---|---|
| committer | Bas van Beek <b.f.van.beek@vu.nl> | 2021-09-30 17:13:32 +0200 |
| commit | e214496119f6b35819cebaa1562818d27b6c34fb (patch) | |
| tree | a920aaebc75e6d67bb6f70a10f65dfd4035ef75a /numpy | |
| parent | 1a0d8b3d877bbfb6c567d675574716e496019014 (diff) | |
| download | numpy-e214496119f6b35819cebaa1562818d27b6c34fb.tar.gz | |
TST: Add more tests for `np.kaiser`
Diffstat (limited to 'numpy')
| -rw-r--r-- | numpy/lib/tests/test_function_base.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index f4f0e5542..66110b479 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -1943,6 +1943,27 @@ class TestFilterwindows: else: assert_almost_equal(np.sum(w, axis=0), 3.7800, 4) + def test_kaiser(self, dtype: str, M: int) -> None: + scalar = np.array(M, dtype=dtype)[()] + + w = kaiser(scalar, 0) + if dtype == "O": + ref_dtype = np.float64 + else: + ref_dtype = np.result_type(scalar.dtype, np.float64) + assert w.dtype == ref_dtype + + # check symmetry + assert_equal(w, flipud(w)) + + # check known value + if scalar < 1: + assert_array_equal(w, np.array([])) + elif scalar == 1: + assert_array_equal(w, np.ones(1)) + else: + assert_almost_equal(np.sum(w, axis=0), 10, 15) + class TestTrapz: |
