Fix changing locale. (#5314)
* Fix changing locale. * Don't use locale guard. As number parsing is implemented in house, we don't need locale. * Update doc.
This commit is contained in:
@@ -5,6 +5,7 @@ import os
|
||||
import json
|
||||
import testing as tm
|
||||
import pytest
|
||||
import locale
|
||||
|
||||
dpath = 'demo/data/'
|
||||
dtrain = xgb.DMatrix(dpath + 'agaricus.txt.train')
|
||||
@@ -300,6 +301,7 @@ class TestModels(unittest.TestCase):
|
||||
'reg_loss_param']['scale_pos_weight']) == 0.5
|
||||
|
||||
def test_model_json_io(self):
|
||||
loc = locale.getpreferredencoding(False)
|
||||
model_path = 'test_model_json_io.json'
|
||||
parameters = {'tree_method': 'hist', 'booster': 'gbtree'}
|
||||
j_model = json_model(model_path, parameters)
|
||||
@@ -313,6 +315,7 @@ class TestModels(unittest.TestCase):
|
||||
assert isinstance(j_model['learner'], dict)
|
||||
|
||||
os.remove(model_path)
|
||||
assert locale.getpreferredencoding(False) == loc
|
||||
|
||||
@pytest.mark.skipif(**tm.no_json_schema())
|
||||
def test_json_schema(self):
|
||||
|
||||
Reference in New Issue
Block a user