<commit_before><commit_msg>test init<commit_after>import pytest
from satyr.config import Config


def test_get_satyr(monkeypatch):
    def mock_create_satyr(config):
        assert isinstance(config, Config)
        return 'SATYR'

    monkeypatch.setattr('satyr.multiprocess.create_satyr', mock_create_satyr)
    from dask_mesos.mesos import get_satyr
    assert get_satyr() == 'SATYR'


test_mesos_settings = [
    ({'cpus': 0, 'mem': 1, 'disk': 2}, {'resources': {
     'cpus': 0, 'mem': 1, 'disk': 2}, 'image': None}),
    ({'cpu': -1, 'cpus': 0, 'mem': 1},
     {'resources': {'cpus': 0, 'mem': 1}, 'image': None}),
    ({'cpus': 0, 'mem': 1, 'image': 'xxx:1.1'}, {
     'resources': {'cpus': 0, 'mem': 1}, 'image': 'xxx:1.1'}),
    ({'image': 'xxx:1.1'}, {'resources': {}, 'image': 'xxx:1.1'})
]


@pytest.mark.parametrize('input,result', test_mesos_settings)
def test_create_satyr_compatible_config_no_image(input, result):
    from dask_mesos.mesos import create_satyr_compatible_config
    assert create_satyr_compatible_config(input) == result
{'fraction_non_alphanumeric': 0.1889838556505223, 'fraction_numerical': 0.02184235517568851, 'mean_word_length': 4.759562841530054, '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': '3284884', 'n_tokens_mistral': 411, 'n_tokens_neox': 390, 'n_words': 84}