@pytest.mark.parametrize((u'model_class', u'mode'), list(itertools.product(test_models_2D, modes)))
def test_pixel_sum_2D(model_class, mode):
 if ((model_class == Box2D) and (mode == u'center')):
  pytest.skip(u'Non integrating mode. Skip integral test.')
 parameters = models_2D[model_class]
 model = create_model(model_class, parameters)
 values = discretize_model(model, models_2D[model_class][u'x_lim'], models_2D[model_class][u'y_lim'], mode=mode)
 assert_allclose(values.sum(), models_2D[model_class][u'integral'], atol=0.0001)

@ pytest . mark . parametrize ( ( u'model_class' , u'mode' ) , list ( itertools . product ( test_models_2D , modes ) ) ) def test_pixel_sum_2D ( model_class , mode ) : if ( ( model_class == Box2D ) and ( mode == u'center' ) ) : pytest . skip ( u'Non integrating mode. Skip integral test.' ) parameters = models_2D [ model_class ] model = create_model ( model_class , parameters ) values = discretize_model ( model , models_2D [ model_class ] [ u'x_lim' ] , models_2D [ model_class ] [ u'y_lim' ] , mode = mode ) assert_allclose ( values . sum ( ) , models_2D [ model_class ] [ u'integral' ] , atol = 0.0001 )
test if the sum of all pixels corresponds nearly to the integral .