# Buggy code
def __init__(
    self,
    n,
    n_iter=3,
    train_size=0.5,
    test_size=None,
    random_state=None,
    n_bootstraps=None,
):
    self.n = n
    if n_bootstraps is not None:  # pragma: no cover
        warnings.warn(
            "n_bootstraps was renamed to n_iter and will be removed in 0.16.",
            DeprecationWarning,
        )
        n_iter = n_bootstraps
    self.n_iter = n_iter
    if isinstance(train_size, numbers.Real) and train_size >= 0.0 and train_size <= 1.0:
        self.train_size = int(ceil(train_size * n))
    elif isinstance(train_size, numbers.Integral):
        self.train_size = train_size
    else:
        raise ValueError("Invalid value for train_size: %r" % train_size)
    if self.train_size > n:
        raise ValueError(
            "train_size=%d should not be larger than n=%d" % (self.train_size, n)
        )

    if isinstance(test_size, numbers.Real) and 0.0 <= test_size <= 1.0:
        self.test_size = int(ceil(test_size * n))
    elif isinstance(test_size, numbers.Integral):
        self.test_size = test_size
    elif test_size is None:
        self.test_size = self.n - self.train_size
    else:
        raise ValueError("Invalid value for test_size: %r" % test_size)
    if self.test_size > n:
        raise ValueError(
            "test_size=%d should not be larger than n=%d" % (self.test_size, n)
        )

    self.random_state = random_state


# Traceback (IndexError)
======================================================================
ERROR: sklearn.tests.test_common.test_regressors_train('RANSACRegressor', <class 'sklearn.linear_model.ransac.RANSACRegr
essor'>, array([[-0.44836249, -0.47282444, -1.20608008, ..., -0.75500806,
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\nose\case.py", line 197, in runTest
self.test(*self.arg)
File "C:\Python27\lib\site-packages\sklearn\tests\test_common.py", line 850, in check_regressors_train
assert_raises(ValueError, regressor.fit, X, y[:-1])
File "C:\Python27\lib\unittest\case.py", line 473, in assertRaises
callableObj(*args, **kwargs)
File "C:\Python27\lib\site-packages\sklearn\linear_model\ransac.py", line 261, in fit
y_subset = y[subset_idxs]
IndexError: index 199 is out of bounds for axis 0 with size 199

# Fixed code
def __init__(
    self,
    n,
    n_iter=3,
    train_size=0.5,
    test_size=None,
    random_state=None,
    n_bootstraps=None,
):
    # See, e.g., http://youtu.be/BzHz0J9a6k0?t=9m38s for a motivation
    # behind this deprecation
    warnings.warn(
        "Bootstrap will no longer be supported as a "
        + "cross-validation method as of version 0.15 and "
        + "will be removed in 0.17",
        DeprecationWarning,
    )
    self.n = n
    if n_bootstraps is not None:  # pragma: no cover
        warnings.warn(
            "n_bootstraps was renamed to n_iter and will be removed in 0.16.",
            DeprecationWarning,
        )
        n_iter = n_bootstraps
    self.n_iter = n_iter
    if isinstance(train_size, numbers.Real) and train_size >= 0.0 and train_size <= 1.0:
        self.train_size = int(ceil(train_size * n))
    elif isinstance(train_size, numbers.Integral):
        self.train_size = train_size
    else:
        raise ValueError("Invalid value for train_size: %r" % train_size)
    if self.train_size > n:
        raise ValueError(
            "train_size=%d should not be larger than n=%d" % (self.train_size, n)
        )

    if isinstance(test_size, numbers.Real) and 0.0 <= test_size <= 1.0:
        self.test_size = int(ceil(test_size * n))
    elif isinstance(test_size, numbers.Integral):
        self.test_size = test_size
    elif test_size is None:
        self.test_size = self.n - self.train_size
    else:
        raise ValueError("Invalid value for test_size: %r" % test_size)
    if self.test_size > n - self.train_size:
        raise ValueError(
            ("test_size + train_size=%d, should not be " + "larger than n=%d")
            % (self.test_size + self.train_size, n)
        )

    self.random_state = random_state