'test that a convolve model can be fitted'

@pytest.mark.parametrize(u'mode', [u'convolve_fft', u'convolve'])
@pytest.mark.skipif(u'not    HAS_SCIPY')
def test_fitting_convolve_models(self, mode):

    b1 = models.Box1D()
    g1 = models.Gaussian1D()
    x = np.linspace((-5), 5, 99)
    fake_model = models.Gaussian1D(amplitude=10)
    with NumpyRNGContext(123):
        fake_data = (fake_model(x) + np.random.normal(size=len(x)))
    init_model = convolve_models(b1, g1, mode=mode, normalize_kernel=False)
    fitter = fitting.LevMarLSQFitter()
    fitted_model = fitter(init_model, x, fake_data)
    me = np.mean((fitted_model(x) - fake_data))
    assert_almost_equal(me, 0.0, decimal=2)
