Skip to content

Commit 3438f87

Browse files
committed
start making consistency tests between convolve and convolve_fft
1 parent 91816ed commit 3438f87

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

‎astropy/convolution/tests/test_convolve.py‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import pytest
66
import numpy as np
77

8-
from ..convolve import convolve
8+
from ..convolve import convolve, convolve_fft
99

1010
from numpy.testing import assert_array_almost_equal_nulp
1111

@@ -20,6 +20,12 @@
2020
INTERPOLATE_OPTIONS = [True, False]
2121
NORMALIZE_OPTIONS = [True, False]
2222

23+
BOUNDARIES_AND_CONVOLUTIONS = (list(zip(itertools.cycle((convolve,)),
24+
BOUNDARY_OPTIONS)) + [(convolve_fft,
25+
'wrap'),
26+
(convolve_fft,
27+
'fill')])
28+
2329

2430
class TestConvolve1D(object):
2531
def test_list(self):
@@ -47,8 +53,8 @@ def test_dtype(self, dtype_array, dtype_kernel):
4753

4854
assert x.dtype == z.dtype
4955

50-
@pytest.mark.parametrize(('boundary'), BOUNDARY_OPTIONS)
51-
def test_unity_1_none(self, boundary):
56+
@pytest.mark.parametrize(('convfunc', 'boundary',), BOUNDARIES_AND_CONVOLUTIONS)
57+
def test_unity_1_none(self, boundary, convfunc):
5258
'''
5359
Test that a unit kernel with a single element returns the same array
5460
'''
@@ -57,9 +63,9 @@ def test_unity_1_none(self, boundary):
5763

5864
y = np.array([1.], dtype='>f8')
5965

60-
z = convolve(x, y, boundary=boundary)
66+
z = convfunc(x, y, boundary=boundary)
6167

62-
assert np.all(z == x)
68+
np.testing.assert_allclose(z, x)
6369

6470
@pytest.mark.parametrize(('boundary'), BOUNDARY_OPTIONS)
6571
def test_unity_3(self, boundary):

0 commit comments

Comments
 (0)