Beispiel #1
0
def test_env():
    env = {
        "DASK_A_B": "123",
        "DASK_C": "True",
        "DASK_D": "hello",
        "DASK_E__X": "123",
        "DASK_E__Y": "456",
        "DASK_F": '[1, 2, "3"]',
        "DASK_G": "/not/parsable/as/literal",
        "FOO": "not included",
    }

    expected = {
        "a_b": 123,
        "c": True,
        "d": "hello",
        "e": {
            "x": 123,
            "y": 456
        },
        "f": [1, 2, "3"],
        "g": "/not/parsable/as/literal",
    }

    res = collect_env(env)
    assert res == expected
def test_env():
    env = {
        'DASK_A_B': '123',
        'DASK_C': 'True',
        'DASK_D': 'hello',
        'DASK_E__X': '123',
        'DASK_E__Y': '456',
        'DASK_F': '[1, 2, "3"]',
        'DASK_G': '/not/parsable/as/literal',
        'FOO': 'not included',
    }

    expected = {
        'a-b': 123,
        'c': True,
        'd': 'hello',
        'e': {
            'x': 123,
            'y': 456
        },
        'f': [1, 2, "3"],
        'g': '/not/parsable/as/literal',
    }

    assert collect_env(env) == expected
Beispiel #3
0
def test_config_inheritance():
    config = collect_env({
        "DASK_INTERNAL_INHERIT_CONFIG":
        serialize({"array": {
            "svg": {
                "size": 150
            }
        }})
    })
    assert dask.config.get("array.svg.size", config=config) == 150
Beispiel #4
0
def test_env():
    env = {'DASK_A_B': '123',
           'DASK_C': 'True',
           'DASK_D': 'hello',
           'DASK_E__X': '123',
           'DASK_E__Y': '456',
           'DASK_F': '[1, 2, "3"]',
           'DASK_G': '/not/parsable/as/literal',
           'FOO': 'not included',
           }

    expected = {
        'a-b': 123,
        'c': True,
        'd': 'hello',
        'e': {'x': 123, 'y': 456},
        'f': [1, 2, "3"],
        'g': '/not/parsable/as/literal',
    }

    assert collect_env(env) == expected