Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.pipelines
Commits
dbb91073
Commit
dbb91073
authored
Nov 20, 2020
by
Tiago de Freitas Pereira
Browse files
[nose] Improved test case
[nose] Improved test case
parent
9a3d419a
Pipeline
#45919
passed with stage
in 8 minutes and 50 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
bob/pipelines/tests/test_wrappers.py
View file @
dbb91073
...
...
@@ -13,6 +13,7 @@ from sklearn.utils.validation import check_array
from
sklearn.utils.validation
import
check_is_fitted
from
bob.pipelines.utils
import
hash_string
import
bob.pipelines
as
mario
import
tempfile
def
_offset_add_func
(
X
,
offset
=
1
):
...
...
@@ -176,14 +177,19 @@ def test_checkpoint_function_sample_transfomer():
_assert_all_close_numpy_array
(
oracle
,
[
s
.
data
for
s
in
features
])
# test when both model_path and features_dir is None
with
tempfile
.
TemporaryDirectory
()
as
dir_name
:
transformer
=
mario
.
wrap
(
[
FunctionTransformer
,
"sample"
,
"checkpoint"
],
func
=
_offset_add_func
,
kw_args
=
dict
(
offset
=
offset
),
validate
=
True
,
features_dir
=
dir_name
,
hash_fn
=
hash_string
,
)
features
=
transformer
.
transform
(
samples
)
# Checking if we have 8 chars in the second level
assert
len
(
features
[
0
].
load
.
args
[
0
].
split
(
"/"
)[
-
2
])
==
8
_assert_all_close_numpy_array
(
oracle
,
[
s
.
data
for
s
in
features
])
...
...
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