From bde797f2838497ecedb7e7704dad79f5b39ea7e1 Mon Sep 17 00:00:00 2001 From: Minghui Liu Date: Thu, 13 Jul 2017 15:05:03 -0700 Subject: [PATCH 1/3] supress deprecation warnings for non_negative option --- sklearn/feature_extraction/tests/test_text.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sklearn/feature_extraction/tests/test_text.py b/sklearn/feature_extraction/tests/test_text.py index de6674646c981..11060007b8355 100644 --- a/sklearn/feature_extraction/tests/test_text.py +++ b/sklearn/feature_extraction/tests/test_text.py @@ -28,7 +28,8 @@ assert_not_equal, assert_almost_equal, assert_in, assert_less, assert_greater, assert_warns_message, assert_raise_message, - clean_warning_registry, SkipTest) + clean_warning_registry, ignore_warnings, + SkipTest) from collections import defaultdict, Mapping from functools import partial @@ -480,6 +481,7 @@ def test_tfidf_vectorizer_setters(): assert_true(tv._tfidf.sublinear_tf) +@ignore_warnings(category=DeprecationWarning) def test_hashing_vectorizer(): v = HashingVectorizer() X = v.transform(ALL_FOOD_DOCS) @@ -651,6 +653,7 @@ def test_count_binary_occurrences(): assert_equal(X_sparse.dtype, np.float32) +@ignore_warnings(category=DeprecationWarning) def test_hashed_binary_occurrences(): # by default multiple occurrences are counted as longs test_data = ['aaabc', 'abbde'] @@ -784,6 +787,7 @@ def test_vectorizer_pipeline_cross_validation(): assert_array_equal(cv_scores, [1., 1., 1.]) +@ignore_warnings(category=DeprecationWarning) def test_vectorizer_unicode(): # tests that the count vectorizer works with cyrillic. document = ( From 29cabba9adb96f37bb0f458624495a1b5f4b1e24 Mon Sep 17 00:00:00 2001 From: Minghui Liu Date: Fri, 14 Jul 2017 02:26:03 -0700 Subject: [PATCH 2/3] more non_negative option deprecation warnings --- sklearn/feature_extraction/tests/test_feature_hasher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sklearn/feature_extraction/tests/test_feature_hasher.py b/sklearn/feature_extraction/tests/test_feature_hasher.py index 0204910607f32..eb84e98094eb2 100644 --- a/sklearn/feature_extraction/tests/test_feature_hasher.py +++ b/sklearn/feature_extraction/tests/test_feature_hasher.py @@ -19,7 +19,7 @@ def test_feature_hasher_dicts(): X2 = FeatureHasher(n_features=16, input_type="pair").transform(gen) assert_array_equal(X1.toarray(), X2.toarray()) - +@ignore_warnings(category=DeprecationWarning) def test_feature_hasher_strings(): # mix byte and Unicode strings; note that "foo" is a duplicate in row 0 raw_X = [["foo", "bar", "baz", "foo".encode("ascii")], From 7267122fc2252bdbf7438b366611817c6ee1e05c Mon Sep 17 00:00:00 2001 From: Minghui Liu Date: Fri, 14 Jul 2017 02:27:42 -0700 Subject: [PATCH 3/3] fix flake8 warning --- sklearn/feature_extraction/tests/test_feature_hasher.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sklearn/feature_extraction/tests/test_feature_hasher.py b/sklearn/feature_extraction/tests/test_feature_hasher.py index eb84e98094eb2..d258625897e27 100644 --- a/sklearn/feature_extraction/tests/test_feature_hasher.py +++ b/sklearn/feature_extraction/tests/test_feature_hasher.py @@ -19,6 +19,7 @@ def test_feature_hasher_dicts(): X2 = FeatureHasher(n_features=16, input_type="pair").transform(gen) assert_array_equal(X1.toarray(), X2.toarray()) + @ignore_warnings(category=DeprecationWarning) def test_feature_hasher_strings(): # mix byte and Unicode strings; note that "foo" is a duplicate in row 0