Skip to content

Commit 19b5993

Browse files
authored
Convert input to str for hypothesis note. (dmlc#9480)
1 parent e3f624d commit 19b5993

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

tests/python-gpu/test_gpu_updaters.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_hist(self, param, num_rounds, dataset):
3636
param["tree_method"] = "gpu_hist"
3737
param = dataset.set_params(param)
3838
result = train_result(param, dataset.get_dmat(), num_rounds)
39-
note(result)
39+
note(str(result))
4040
assert tm.non_increasing(result["train"][dataset.metric])
4141

4242

@@ -90,12 +90,12 @@ def test_gpu_approx(
9090
def test_sparse(self, dataset):
9191
param = {"tree_method": "hist", "max_bin": 64}
9292
hist_result = train_result(param, dataset.get_dmat(), 16)
93-
note(hist_result)
93+
note(str(hist_result))
9494
assert tm.non_increasing(hist_result["train"][dataset.metric])
9595

9696
param = {"tree_method": "gpu_hist", "max_bin": 64}
9797
gpu_hist_result = train_result(param, dataset.get_dmat(), 16)
98-
note(gpu_hist_result)
98+
note(str(gpu_hist_result))
9999
assert tm.non_increasing(gpu_hist_result["train"][dataset.metric])
100100

101101
np.testing.assert_allclose(
@@ -221,7 +221,7 @@ def test_gpu_hist_device_dmatrix(
221221
dataset.get_device_dmat(max_bin=param.get("max_bin", None)),
222222
num_rounds,
223223
)
224-
note(result)
224+
note(str(result))
225225
assert tm.non_increasing(result["train"][dataset.metric], tolerance=1e-3)
226226

227227
@given(

tests/python/test_updaters.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def test_approx(
5858
param.update(hist_param)
5959
param.update(cache_param)
6060
result = train_result(param, dataset.get_dmat(), num_rounds)
61-
note(result)
61+
note(str(result))
6262
assert tm.non_increasing(result["train"][dataset.metric])
6363

6464
@given(
@@ -84,7 +84,7 @@ def test_hist(
8484
param.update(hist_param)
8585
param.update(cache_param)
8686
result = train_result(param, dataset.get_dmat(), num_rounds)
87-
note(result)
87+
note(str(result))
8888
assert tm.non_increasing(result["train"][dataset.metric])
8989

9090

@@ -125,7 +125,7 @@ def test_approx(
125125
param.update(hist_param)
126126
param.update(cache_param)
127127
result = train_result(param, dataset.get_dmat(), num_rounds)
128-
note(result)
128+
note(str(result))
129129
assert tm.non_increasing(result["train"][dataset.metric])
130130

131131
@pytest.mark.skipif(**tm.no_sklearn())
@@ -172,7 +172,7 @@ def test_hist(
172172
param.update(hist_param)
173173
param.update(cache_param)
174174
result = train_result(param, dataset.get_dmat(), num_rounds)
175-
note(result)
175+
note(str(result))
176176
assert tm.non_increasing(result["train"][dataset.metric])
177177

178178
def test_hist_categorical(self):
@@ -224,12 +224,12 @@ def test_hist_degenerate_case(self):
224224
def test_sparse(self, dataset):
225225
param = {"tree_method": "hist", "max_bin": 64}
226226
hist_result = train_result(param, dataset.get_dmat(), 16)
227-
note(hist_result)
227+
note(str(hist_result))
228228
assert tm.non_increasing(hist_result['train'][dataset.metric])
229229

230230
param = {"tree_method": "approx", "max_bin": 64}
231231
approx_result = train_result(param, dataset.get_dmat(), 16)
232-
note(approx_result)
232+
note(str(approx_result))
233233
assert tm.non_increasing(approx_result['train'][dataset.metric])
234234

235235
np.testing.assert_allclose(

tests/test_distributed/test_gpu_with_dask/test_gpu_with_dask.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def run_gpu_hist(
187187
num_boost_round=num_rounds,
188188
evals=[(m, "train")],
189189
)["history"]["train"][dataset.metric]
190-
note(history)
190+
note(str(history))
191191

192192
# See note on `ObjFunction::UpdateTreeLeaf`.
193193
update_leaf = dataset.name.endswith("-l1")

tests/test_distributed/test_with_dask/test_with_dask.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1484,7 +1484,7 @@ def run_updater_test(
14841484
num_boost_round=num_rounds,
14851485
evals=[(m, "train")],
14861486
)["history"]
1487-
note(history)
1487+
note(str(history))
14881488
history = history["train"][dataset.metric]
14891489

14901490
def is_stump():

0 commit comments

Comments
 (0)