Skip to content
Snippets Groups Projects
Commit dbb91073 authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira
Browse files

[nose] Improved test case

[nose] Improved test case
parent 9a3d419a
No related branches found
No related tags found
1 merge request!48Improvements on CheckpointWrapper
Pipeline #45919 passed
...@@ -13,6 +13,7 @@ from sklearn.utils.validation import check_array ...@@ -13,6 +13,7 @@ from sklearn.utils.validation import check_array
from sklearn.utils.validation import check_is_fitted from sklearn.utils.validation import check_is_fitted
from bob.pipelines.utils import hash_string from bob.pipelines.utils import hash_string
import bob.pipelines as mario import bob.pipelines as mario
import tempfile
def _offset_add_func(X, offset=1): def _offset_add_func(X, offset=1):
...@@ -176,15 +177,20 @@ def test_checkpoint_function_sample_transfomer(): ...@@ -176,15 +177,20 @@ def test_checkpoint_function_sample_transfomer():
_assert_all_close_numpy_array(oracle, [s.data for s in features]) _assert_all_close_numpy_array(oracle, [s.data for s in features])
# test when both model_path and features_dir is None # test when both model_path and features_dir is None
transformer = mario.wrap( with tempfile.TemporaryDirectory() as dir_name:
[FunctionTransformer, "sample", "checkpoint"], transformer = mario.wrap(
func=_offset_add_func, [FunctionTransformer, "sample", "checkpoint"],
kw_args=dict(offset=offset), func=_offset_add_func,
validate=True, kw_args=dict(offset=offset),
hash_fn=hash_string, validate=True,
) features_dir=dir_name,
features = transformer.transform(samples) hash_fn=hash_string,
_assert_all_close_numpy_array(oracle, [s.data for s in features]) )
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])
def test_checkpoint_fittable_sample_transformer(): def test_checkpoint_fittable_sample_transformer():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment