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
710f1ae6
"tests/vscode:/vscode.git/clone" did not exist on "9445b2ca261158baa855272e29ad4ac291843414"
Commit
710f1ae6
authored
Jan 24, 2020
by
James Lamb
Committed by
Nikita Titov
Jan 24, 2020
Browse files
[R-package] added test that Dataset$setinfo() converts 'group' input to integer (#2687)
parent
8a4c5494
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
R-package/tests/testthat/test_dataset.R
R-package/tests/testthat/test_dataset.R
+13
-0
No files found.
R-package/tests/testthat/test_dataset.R
View file @
710f1ae6
...
...
@@ -86,3 +86,16 @@ test_that("lgb.Dataset: Dataset should be able to construct from matrix and retu
)
expect_false
(
is.na
(
handle
))
})
test_that
(
"lgb.Dataset$setinfo() should convert 'group' to integer"
,
{
ds
<-
lgb.Dataset
(
data
=
matrix
(
rnorm
(
100L
),
nrow
=
50L
,
ncol
=
2L
)
,
label
=
sample
(
c
(
0L
,
1L
),
size
=
50L
,
replace
=
TRUE
)
)
ds
$
construct
()
current_group
<-
ds
$
getinfo
(
"group"
)
expect_null
(
current_group
)
group_as_numeric
<-
rep
(
25.0
,
2L
)
ds
$
setinfo
(
"group"
,
group_as_numeric
)
expect_identical
(
ds
$
getinfo
(
"group"
),
as.integer
(
group_as_numeric
))
})
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