<commit_before>import jug
from jug import value
import jug.options
from jug.tests.task_reset import task_reset

@task_reset
def test_nfoldcrossvalidation():
    store, space = jug.jug.init('milk/tests/data/jugparallel_jugfile.py', 'dict_store')
    options = jug.options.default_options
    jug.jug.execute(store, options)
    assert len(jug.value(space['classified'])) == 2
    assert len(jug.value(space['classified_wpred'])) ==3


@task_reset
def test_kmeans():
    from jug.task import alltasks
    store, space = jug.jug.init('milk/tests/data/jugparallel_kmeans_jugfile.py', 'dict_store')
    options = jug.options.default_options
    assert len(alltasks) == 5

    jug.jug.execute(store, options)
    assert len(value(space['clustered'])) == 2<commit_msg>TST Skip testing jug utilities if jug is not found<commit_after>try:
    import jug
    from jug import value
    import jug.options
    from jug.tests.task_reset import task_reset
except ImportError:
    from nose import SkipTest
    def task_reset(f):
        def g():
            raise SkipTest()
        return g

@task_reset
def test_nfoldcrossvalidation():
    store, space = jug.jug.init('milk/tests/data/jugparallel_jugfile.py', 'dict_store')
    options = jug.options.default_options
    jug.jug.execute(store, options)
    assert len(jug.value(space['classified'])) == 2
    assert len(jug.value(space['classified_wpred'])) ==3


@task_reset
def test_kmeans():
    from jug.task import alltasks
    store, space = jug.jug.init('milk/tests/data/jugparallel_kmeans_jugfile.py', 'dict_store')
    options = jug.options.default_options
    assert len(alltasks) == 5

    jug.jug.execute(store, options)
    assert len(value(space['clustered'])) == 2
{'fraction_non_alphanumeric': 0.11888111888111888, 'fraction_numerical': 0.004662004662004662, 'mean_word_length': 4.094955489614243, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6593810', 'n_tokens_mistral': 575, 'n_tokens_neox': 535, 'n_words': 123}