<commit_before>import os
from toil.job import Job


def test_map_job(tmpdir):
    from toil_scripts.lib.jobs import map_job
    options = Job.Runner.getDefaultOptions(os.path.join(str(tmpdir), 'test_store'))
    samples = [x for x in xrange(200)]
    j = Job.wrapJobFn(map_job, _test_batch, samples, 'a', 'b', 'c', disk='1K')
    Job.Runner.startToil(j, options)


def _test_batch(job, sample, a, b, c):
    assert str(sample).isdigit()
    assert a == 'a'
    assert b == 'b'
    assert c == 'c'<commit_msg>Use get_work_directory for test_map_job<commit_after>import os
from toil.job import Job
from toil_scripts.lib import get_work_directory


def test_map_job(tmpdir):
    from toil_scripts.lib.jobs import map_job
    work_dir = get_work_directory()
    options = Job.Runner.getDefaultOptions(os.path.join(work_dir, 'test_store'))
    options.workDir = work_dir
    samples = [x for x in xrange(200)]
    j = Job.wrapJobFn(map_job, _test_batch, samples, 'a', 'b', 'c', disk='1K')
    Job.Runner.startToil(j, options)


def _test_batch(job, sample, a, b, c):
    assert str(sample).isdigit()
    assert a == 'a'
    assert b == 'b'
    assert c == 'c'
{'fraction_non_alphanumeric': 0.13518197573656845, 'fraction_numerical': 0.006932409012131715, 'mean_word_length': 3.978448275862069, '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': '2478128', 'n_tokens_mistral': 433, 'n_tokens_neox': 424, 'n_words': 106}