Skip to content

Commit 8d15024

Browse files
henry0312terrytangyuan
authored andcommitted
python: follow the default warning filters of Python (#2666)
* python: follow the default warning filters of Python https://docs.python.org/3/library/warnings.html#default-warning-filters * update tests * update tests
1 parent 1785175 commit 8d15024

File tree

2 files changed

+0
-19
lines changed

2 files changed

+0
-19
lines changed

python-package/xgboost/sklearn.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
from .compat import (SKLEARN_INSTALLED, XGBModelBase,
1414
XGBClassifierBase, XGBRegressorBase, XGBLabelEncoder)
1515

16-
warnings.simplefilter('always', DeprecationWarning)
17-
1816

1917
def _objective_decorator(func):
2018
"""Decorate an objective function

tests/python/test_with_sklearn.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import random
33
import xgboost as xgb
44
import testing as tm
5-
import warnings
65
from nose.tools import raises
76

87
rng = np.random.RandomState(1994)
@@ -340,14 +339,6 @@ def test_sklearn_random_state():
340339
assert clf.get_xgb_params()['seed'] == 401
341340

342341

343-
def test_seed_deprecation():
344-
tm._skip_if_no_sklearn()
345-
warnings.simplefilter("always")
346-
with warnings.catch_warnings(record=True) as w:
347-
xgb.XGBClassifier(seed=1).get_xgb_params()
348-
assert w[0].category == DeprecationWarning
349-
350-
351342
def test_sklearn_n_jobs():
352343
tm._skip_if_no_sklearn()
353344

@@ -358,14 +349,6 @@ def test_sklearn_n_jobs():
358349
assert clf.get_xgb_params()['nthread'] == 2
359350

360351

361-
def test_nthread_deprecation():
362-
tm._skip_if_no_sklearn()
363-
warnings.simplefilter("always")
364-
with warnings.catch_warnings(record=True) as w:
365-
xgb.XGBClassifier(nthread=1).get_xgb_params()
366-
assert w[0].category == DeprecationWarning
367-
368-
369352
def test_kwargs():
370353
tm._skip_if_no_sklearn()
371354

0 commit comments

Comments
 (0)