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
Pipeline #45919 passed with stage
in 8 minutes and 50 seconds
...@@ -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():
......
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