Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
adb7ee19
Unverified
Commit
adb7ee19
authored
May 22, 2025
by
Nick Miller
Committed by
GitHub
May 23, 2025
Browse files
[python-package] Add more specific error messages to `test_engine` (#6926)
add error messages to test_get_split_value_histogram
parent
22371f00
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
tests/python_package_test/test_engine.py
tests/python_package_test/test_engine.py
+5
-3
No files found.
tests/python_package_test/test_engine.py
View file @
adb7ee19
...
...
@@ -3161,9 +3161,9 @@ def test_get_split_value_histogram(rng_fixed_seed):
hist
,
bins
=
gbm
.
get_split_value_histogram
(
0
,
bins
=
999
)
assert
len
(
hist
)
==
999
assert
len
(
bins
)
==
1000
with
pytest
.
raises
(
ValueError
):
with
pytest
.
raises
(
ValueError
,
match
=
"`bins` must be positive, when an integer"
):
gbm
.
get_split_value_histogram
(
0
,
bins
=-
1
)
with
pytest
.
raises
(
ValueError
):
with
pytest
.
raises
(
ValueError
,
match
=
"`bins` must be positive, when an integer"
):
gbm
.
get_split_value_histogram
(
0
,
bins
=
0
)
hist
,
bins
=
gbm
.
get_split_value_histogram
(
0
,
bins
=
1
)
assert
len
(
hist
)
==
1
...
...
@@ -3197,7 +3197,9 @@ def test_get_split_value_histogram(rng_fixed_seed):
np
.
testing
.
assert_array_equal
(
hist_vals
[
mask
],
hist
[:,
1
])
np
.
testing
.
assert_allclose
(
bin_edges
[
1
:][
mask
],
hist
[:,
0
])
# test histogram is disabled for categorical features
with
pytest
.
raises
(
lgb
.
basic
.
LightGBMError
):
with
pytest
.
raises
(
lgb
.
basic
.
LightGBMError
,
match
=
"Cannot compute split value histogram for the categorical feature"
):
gbm
.
get_split_value_histogram
(
2
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment