Unverified Commit 7fa4432b authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[R-package] fix test on non-ASCII features in non-UTF8 locales (#5526)

parent fb7f5eac
...@@ -1719,7 +1719,18 @@ test_that("lgb.train() supports non-ASCII feature names", { ...@@ -1719,7 +1719,18 @@ test_that("lgb.train() supports non-ASCII feature names", {
data = matrix(rnorm(400L), ncol = 4L) data = matrix(rnorm(400L), ncol = 4L)
, label = rnorm(100L) , label = rnorm(100L)
) )
feature_names <- c("F_零", "F_一", "F_二", "F_三") # content below is equivalent to
#
# feature_names <- c("F_零", "F_一", "F_二", "F_三")
#
# but using rawToChar() to avoid weird issues when {testthat}
# sources files and converts their encodings prior to evaluating the code
feature_names <- c(
rawToChar(as.raw(c(0x46, 0x5f, 0xe9, 0x9b, 0xb6)))
, rawToChar(as.raw(c(0x46, 0x5f, 0xe4, 0xb8, 0x80)))
, rawToChar(as.raw(c(0x46, 0x5f, 0xe4, 0xba, 0x8c)))
, rawToChar(as.raw(c(0x46, 0x5f, 0xe4, 0xb8, 0x89)))
)
bst <- lgb.train( bst <- lgb.train(
data = dtrain data = dtrain
, nrounds = 5L , nrounds = 5L
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment