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
41ba9e8f
Unverified
Commit
41ba9e8f
authored
Sep 03, 2024
by
James Lamb
Committed by
GitHub
Sep 03, 2024
Browse files
[ci] prevent C API tests from leaving files behind (fixes #6361) (#6637)
parent
3ccdea1a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
tests/c_api_test/test_.py
tests/c_api_test/test_.py
+7
-7
No files found.
tests/c_api_test/test_.py
View file @
41ba9e8f
...
@@ -25,7 +25,7 @@ dtype_int64 = 3
...
@@ -25,7 +25,7 @@ dtype_int64 = 3
def
c_str
(
string
):
def
c_str
(
string
):
return
ctypes
.
c_char_p
(
string
.
encode
(
"utf-8"
))
return
ctypes
.
c_char_p
(
str
(
string
)
.
encode
(
"utf-8"
))
def
load_from_file
(
filename
,
reference
):
def
load_from_file
(
filename
,
reference
):
...
@@ -203,8 +203,8 @@ def test_booster(tmp_path):
...
@@ -203,8 +203,8 @@ def test_booster(tmp_path):
LIB
.
LGBM_BoosterCreateFromModelfile
(
c_str
(
str
(
model_path
)),
ctypes
.
byref
(
num_total_model
),
ctypes
.
byref
(
booster2
))
LIB
.
LGBM_BoosterCreateFromModelfile
(
c_str
(
str
(
model_path
)),
ctypes
.
byref
(
num_total_model
),
ctypes
.
byref
(
booster2
))
data
=
np
.
loadtxt
(
str
(
binary_example_dir
/
"binary.test"
),
dtype
=
np
.
float64
)
data
=
np
.
loadtxt
(
str
(
binary_example_dir
/
"binary.test"
),
dtype
=
np
.
float64
)
mat
=
data
[:,
1
:]
mat
=
data
[:,
1
:]
pre
b
=
np
.
empty
(
mat
.
shape
[
0
],
dtype
=
np
.
float64
)
pre
ds
=
np
.
empty
(
mat
.
shape
[
0
],
dtype
=
np
.
float64
)
num_pre
b
=
ctypes
.
c_int64
(
0
)
num_pre
ds
=
ctypes
.
c_int64
(
0
)
data
=
np
.
asarray
(
mat
.
reshape
(
mat
.
size
),
dtype
=
np
.
float64
)
data
=
np
.
asarray
(
mat
.
reshape
(
mat
.
size
),
dtype
=
np
.
float64
)
LIB
.
LGBM_BoosterPredictForMat
(
LIB
.
LGBM_BoosterPredictForMat
(
booster2
,
booster2
,
...
@@ -217,8 +217,8 @@ def test_booster(tmp_path):
...
@@ -217,8 +217,8 @@ def test_booster(tmp_path):
ctypes
.
c_int
(
0
),
ctypes
.
c_int
(
0
),
ctypes
.
c_int
(
25
),
ctypes
.
c_int
(
25
),
c_str
(
""
),
c_str
(
""
),
ctypes
.
byref
(
num_pre
b
),
ctypes
.
byref
(
num_pre
ds
),
pre
b
.
ctypes
.
data_as
(
ctypes
.
POINTER
(
ctypes
.
c_double
)),
pre
ds
.
ctypes
.
data_as
(
ctypes
.
POINTER
(
ctypes
.
c_double
)),
)
)
LIB
.
LGBM_BoosterPredictForFile
(
LIB
.
LGBM_BoosterPredictForFile
(
booster2
,
booster2
,
...
@@ -228,7 +228,7 @@ def test_booster(tmp_path):
...
@@ -228,7 +228,7 @@ def test_booster(tmp_path):
ctypes
.
c_int
(
0
),
ctypes
.
c_int
(
0
),
ctypes
.
c_int
(
25
),
ctypes
.
c_int
(
25
),
c_str
(
""
),
c_str
(
""
),
c_str
(
"pre
b
.txt"
),
c_str
(
tmp_path
/
"pre
ds
.txt"
),
)
)
LIB
.
LGBM_BoosterPredictForFile
(
LIB
.
LGBM_BoosterPredictForFile
(
booster2
,
booster2
,
...
@@ -238,7 +238,7 @@ def test_booster(tmp_path):
...
@@ -238,7 +238,7 @@ def test_booster(tmp_path):
ctypes
.
c_int
(
10
),
ctypes
.
c_int
(
10
),
ctypes
.
c_int
(
25
),
ctypes
.
c_int
(
25
),
c_str
(
""
),
c_str
(
""
),
c_str
(
"pre
b
.txt"
),
c_str
(
tmp_path
/
"pre
ds
.txt"
),
)
)
LIB
.
LGBM_BoosterFree
(
booster2
)
LIB
.
LGBM_BoosterFree
(
booster2
)
...
...
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