Did I find the right examples for you? yes no

All Samples(21)  |  Call(16)  |  Derive(0)  |  Import(5)

src/s/c/scikit-learn-0.14.1/sklearn/metrics/tests/test_metrics.py   scikit-learn(Download)
from sklearn.utils import check_random_state, shuffle
from sklearn.utils.multiclass import unique_labels
from sklearn.utils.testing import (assert_true,
                                   assert_raises,
                                   assert_raise_message,
    # y_true contains only one class value
    y_true = np.zeros(10, dtype="int")
    assert_raise_message(ValueError, "AUC is defined for binary "
                         "classification only", roc_auc_score, y_true, y_pred)
    y_true = np.ones(10, dtype="int")
    assert_raise_message(ValueError, "AUC is defined for binary "
                         "classification only", roc_auc_score, y_true, y_pred)
    y_true = -np.ones(10, dtype="int")
    assert_raise_message(ValueError, "AUC is defined for binary "
    # y_true contains three different class values
    y_true = rng.randint(0, 3, size=10)
    assert_raise_message(ValueError, "AUC is defined for binary "
                         "classification only", roc_auc_score, y_true, y_pred)
 

src/s/c/scikit-learn-0.14.1/sklearn/tests/test_grid_search.py   scikit-learn(Download)
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import assert_raise_message
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_array_equal
 
    # giving no scoring function raises an error
    assert_raise_message(TypeError, "no scoring",
                         GridSearchCV, clf_no_score, {'C': Cs})
 

src/s/c/scikit-learn-0.14.1/sklearn/utils/tests/test_testing.py   scikit-learn(Download)
from nose.tools import assert_raises
 
from sklearn.utils.testing import (
    _assert_less,
    _assert_greater,
def test_assert_raise_message():
    def _raise_ValueError(message):
        raise ValueError(message)
 
    assert_raise_message(ValueError, "test",

src/s/c/scikit-learn-0.14.1/sklearn/metrics/cluster/tests/test_supervised.py   scikit-learn(Download)
from sklearn.metrics.cluster import entropy
 
from sklearn.utils.testing import assert_raise_message
from nose.tools import assert_almost_equal
from nose.tools import assert_equal
def test_error_messages_on_wrong_input():
    for score_func in score_funcs:
        expected = ('labels_true and labels_pred must have same size,'
                    ' got 2 and 3')
        assert_raise_message(ValueError, expected, score_func,
                             [0, 1], [1, 1, 1])
 
        expected = "labels_true must be 1D: shape is (2"
        assert_raise_message(ValueError, expected, score_func,
 
        expected = "labels_pred must be 1D: shape is (2"
        assert_raise_message(ValueError, expected, score_func,
                             [0, 1, 0], [[1, 1], [0, 0]])
 

src/s/c/scikit-learn-0.14.1/sklearn/tests/test_random_projection.py   scikit-learn(Download)
    GaussianRandomProjection)
 
from sklearn.utils.testing import (
    assert_less,
    assert_raises,
            ' of 5920 which is larger than the original space with'
            ' n_features=100')
        assert_raise_message(ValueError, expected_msg, rp.fit, data)