Did I find the right examples for you? yes no

All Samples(11)  |  Call(7)  |  Derive(0)  |  Import(4)

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,
 
        for beta in [1]:
            p, r, f, s = assert_warns(UserWarning,
                                      precision_recall_fscore_support,
                                      y_true, y_pred, average=None, beta=beta)
            assert_array_almost_equal(s, [0, 0, 0], 2)
 
            fbeta = assert_warns(UserWarning, fbeta_score, y_true, y_pred,
                                 beta=beta, average=None)
            assert_array_almost_equal(fbeta, [0, 0, 0], 2)
 
            for average in ["macro", "micro", "weighted", "samples"]:
                p, r, f, s = assert_warns(UserWarning,
                assert_equal(s, None)
 
                fbeta = assert_warns(UserWarning, fbeta_score, y_true, y_pred,
                                     beta=beta, average=average)
                assert_almost_equal(fbeta, 0)

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,
 
        before_filters = sys.modules['warnings'].filters[:]
        assert_equal(assert_warns(UserWarning, f), 3)
        after_filters = sys.modules['warnings'].filters
 
            try:
                # Should raise an AssertionError
                assert_warns(UserWarning, f)
                failed = True
            except AssertionError:

src/s/c/scikit-learn-0.14.1/sklearn/svm/tests/test_sparse.py   scikit-learn(Download)
from sklearn.utils import ConvergenceWarning
from sklearn.utils.extmath import safe_sparse_dot
from sklearn.utils.testing import assert_warns
 
# test sample 1
        warnings.simplefilter("always")
 
        assert_warns(ConvergenceWarning, sp.fit, X_sp, Y)
 
 

src/n/i/nilearn-HEAD/nilearn/image/tests/test_resampling.py   nilearn(Download)
 
try:
    from sklearn.utils.testing import assert_warns
except ImportError:
    # New in scikit-learn 0.14