Exemplo n.º 1
0
def test_combine_batch_params_glob(tmpdir):
    tmpdir = str(tmpdir)
    create_tree(tmpdir, {"aaa": "a",
                         "subdir": {"b": "b", "c": "c"}})
    with chpwd(tmpdir):
        res = sorted(_combine_batch_params(["foo=a*,subdir/*,other"]),
                     key=lambda d: d["foo"])
        assert list(res) == [
            {"foo": "aaa"},
            {"foo": "other"},
            {"foo": "subdir/b"},
            {"foo": "subdir/c"}]
Exemplo n.º 2
0
def test_combine_batch_params_no_equal():
    with pytest.raises(ValueError):
        list(_combine_batch_params(["a"]))
Exemplo n.º 3
0
def test_combine_batch_params_repeat_key():
    with pytest.raises(ValueError):
        list(_combine_batch_params(["a=1", "a=2"]))
Exemplo n.º 4
0
def test_combine_batch_params(params, expected):
    actual = list(sorted(_combine_batch_params(params),
                         key=lambda d: (d.get("a"), d.get("b"))))
    assert len(actual) == len(expected)
    assert actual == expected