'Test fitting with non-linear LevMarLSQFitter'

@pytest.mark.parametrize((u'model_class', u'constraints'), list(product(sorted(linear1d, key=str), (False, True))))
def test_non_linear_fitter_1D(self, model_class, constraints):

    model_args = linear1d[model_class]
    kwargs = {}
    kwargs.update(model_args[u'kwargs'])
    kwargs.update(model_args[u'parameters'])
    if constraints:
        kwargs.update(model_args[u'constraints'])
    model = model_class(*model_args[u'args'], **kwargs)
    y1 = model(self.x1)
    model_nlin = self.non_linear_fitter(model, self.x1, (y1 + self.n1))
    if constraints:
        fixed = model_args[u'constraints'].get(u'fixed', None)
        if fixed:
            for (param, value) in fixed.items():
                expected = model_args[u'parameters'][param]
                assert (getattr(model_nlin, param).value == expected)
    else:
        assert_allclose(model_nlin.parameters, model.parameters, atol=0.2)
