'Test bounding box evaluation'

def test_bounding_box2D(self, model_class, test_parameters):

    model = create_model(model_class, test_parameters)
    model.bounding_box = (((-5), 5), ((-5), 5))
    assert (model.bounding_box == (((-5), 5), ((-5), 5)))
    model.bounding_box = None
    with pytest.raises(NotImplementedError):
        model.bounding_box
    with pytest.raises(ValueError):
        model.bounding_box = ((-5), 5)
    del model.bounding_box
    try:
        bbox = model.bounding_box
    except NotImplementedError:
        pytest.skip(u'Bounding_box    is    not    defined    for    model.')
    (ylim, xlim) = bbox
    (dy, dx) = (np.diff(bbox) / 2)
    (y1, x1) = np.mgrid[(slice(ylim[0], (ylim[1] + 1)), slice(xlim[0], (xlim[1] + 1)))]
    (y2, x2) = np.mgrid[(slice((ylim[0] - dy), ((ylim[1] + dy) + 1)), slice((xlim[0] - dx), ((xlim[1] + dx) + 1)))]
    arr = model(x2, y2)
    sub_arr = model(x1, y1)
    assert (abs((arr.sum() - sub_arr.sum())) < (arr.sum() * 1e-07))
