def test_aggregate_fields_errors():
    """
    Test that the errors are correctly captured in the aggregate_fields
    function.
    """
    data = np.arange(4 * 6).reshape(4, 6)

    with raises(ValueError):
        dimension.aggregate_fields(data, -1, axis=0)
    with raises(ValueError):
        dimension.aggregate_fields(data, 0, axis=0)
    with raises(ValueError):
        dimension.aggregate_fields(data, 1, method="invalid")

    with raises(TypeError):
        dimension.aggregate_fields(data, (1, 1), axis=0)
Test that the errors are correctly captured in the aggregate_fields
function.
pysteps/tests/test_utils_dimension.py