# Buggy code
def fit(self, X, y, sample_weight=None, weight=None):
    """Fit the model using X, y as training data.

    Parameters
    ----------
    X : array-like, shape=(n_samples,)
        Training data.

    y : array-like, shape=(n_samples,)
        Training target.

    sample_weight : array-like, shape=(n_samples,), optional, default: None
        Weights. If set to None, all weights will be set to 1 (equal
        weights).

    Returns
    -------
    self : object
        Returns an instance of self.

    Notes
    -----
    X is stored for future use, as `transform` needs X to interpolate
    new input data.
    """
    if weight is not None:
        warnings.warn(
            "'weight' was renamed to 'sample_weight' and will be removed in 0.16.",
            DeprecationWarning,
        )
        sample_weight = weight

    X, y, sample_weight = check_arrays(X, y, sample_weight, sparse_format="dense")
    y = as_float_array(y)
    self._check_fit_data(X, y, sample_weight)

    # Determine increasing if auto-determination requested
    if self.increasing == "auto":
        self.increasing_ = check_increasing(X, y)
    else:
        self.increasing_ = self.increasing

    order = np.argsort(X)
    self.X_ = as_float_array(X[order], copy=False)
    self.y_ = isotonic_regression(
        y[order], sample_weight, self.y_min, self.y_max, increasing=self.increasing_
    )

    # Handle the left and right bounds on X
    self.X_min_ = np.min(self.X_)
    self.X_max_ = np.max(self.X_)

    return self


# 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 fit(self, X, y, sample_weight=None, weight=None):
    """Fit the model using X, y as training data.

    Parameters
    ----------
    X : array-like, shape=(n_samples,)
        Training data.

    y : array-like, shape=(n_samples,)
        Training target.

    sample_weight : array-like, shape=(n_samples,), optional, default: None
        Weights. If set to None, all weights will be set to 1 (equal
        weights).

    Returns
    -------
    self : object
        Returns an instance of self.

    Notes
    -----
    X is stored for future use, as `transform` needs X to interpolate
    new input data.
    """
    if weight is not None:
        warnings.warn(
            "'weight' was renamed to 'sample_weight' and will be removed in 0.16.",
            DeprecationWarning,
        )
        sample_weight = weight

    # Build y_
    order_inv = self._build_y(X, y, sample_weight)

    # Handle the left and right bounds on X
    self.X_min_ = np.min(self.X_)
    self.X_max_ = np.max(self.X_)

    # Build f_
    self._build_f(self.X_, self.y_)

    return self