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
336a77df
Unverified
Commit
336a77df
authored
Sep 20, 2025
by
Thomas J. Fan
Committed by
GitHub
Sep 20, 2025
Browse files
[python-package] Add unit test for Dataset.set_field and no data (#7036)
parent
89461519
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
tests/python_package_test/test_basic.py
tests/python_package_test/test_basic.py
+13
-0
No files found.
tests/python_package_test/test_basic.py
View file @
336a77df
...
@@ -1017,3 +1017,16 @@ def test_equal_datasets_from_one_and_several_matrices_w_different_layouts(rng, t
...
@@ -1017,3 +1017,16 @@ def test_equal_datasets_from_one_and_several_matrices_w_different_layouts(rng, t
lgb
.
Dataset
(
mat
).
_dump_text
(
one_path
)
lgb
.
Dataset
(
mat
).
_dump_text
(
one_path
)
assert
filecmp
.
cmp
(
one_path
,
several_path
)
assert
filecmp
.
cmp
(
one_path
,
several_path
)
def
test_set_field_none_removes_field
(
rng
):
X1
=
rng
.
uniform
(
size
=
(
10
,
1
))
d1
=
lgb
.
Dataset
(
X1
).
construct
()
weight
=
rng
.
uniform
(
size
=
10
)
out
=
d1
.
set_field
(
"weight"
,
weight
)
assert
out
is
d1
np
.
testing
.
assert_allclose
(
d1
.
get_field
(
"weight"
),
weight
)
d1
.
set_field
(
"weight"
,
None
)
assert
d1
.
get_field
(
"weight"
)
is
None
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