Ejemplo n.º 1
0
def test_set_dir():
    """[Base] Test setting temp dir."""
    before = config.get_tmpdir()

    config.set_tmpdir(os.getcwd())

    after = config.get_tmpdir()

    assert before != after
Ejemplo n.º 2
0
def test_check_cache():
    """[Base] Test check cache."""
    tmp = config.get_prefix() + "test"
    os.mkdir(tmp)
    with open(os.devnull, 'w') as f, redirect_stderr(f):
        subprocess.Popen("echo this is a test >> " + tmp +
                         "/test.txt", shell=True)
        config.clear_cache(config.get_tmpdir())
Ejemplo n.º 3
0
def test_reset_dir():
    """[Base] Test resetting temp dir."""
    config.set_tmpdir(tmpdir)
    assert config.get_tmpdir() == tmpdir
Ejemplo n.º 4
0
from mlens.index import (FoldIndex,
                         BlendIndex,
                         SubsetIndex,
                         TemporalIndex,
                         ClusteredSubsetIndex,
                         FullIndex)

from mlens.index.base import partition, prune_train
try:
    from contextlib import redirect_stderr
except ImportError:
    from mlens.externals.fixes import redirect as redirect_stderr

X = np.arange(25).reshape(5, 5)

tmpdir = config.get_tmpdir()


class ClusterEstimator(object):

    """Dummy clustering estimator.
    """

    def __init__(self, type=1):
        self.type = type
        pass

    @staticmethod
    def fit(X):
        """Vacuous"""
        pass