How to use the sacred.config.custom_containers.DogmaticList function in sacred

To help you get started, we’ve selected a few sacred examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github IDSIA / sacred / tests / test_config / test_dogmatic_list.py View on Github external
def test_init():
    l = DogmaticList()
    assert l == []

    l2 = DogmaticList([2, 3, 1])
    assert l2 == [2, 3, 1]
github IDSIA / sacred / tests / test_config / test_config_dict.py View on Github external
def is_dogmatic(a):
    if isinstance(a, (DogmaticDict, DogmaticList)):
        return True
    elif isinstance(a, dict):
        return any(is_dogmatic(v) for v in a.values())
    elif isinstance(a, (list, tuple)):
        return any(is_dogmatic(v) for v in a)
github IDSIA / sacred / tests / test_config / test_dogmatic_list.py View on Github external
def test_setslice():
    l = DogmaticList([1, 2, 3])
    l[1:3] = [4, 5]
    assert l == [1, 2, 3]
github IDSIA / sacred / tests / test_config / test_dogmatic_list.py View on Github external
def test_sort():
    l = DogmaticList([3, 1, 2])
    l.sort()
    assert l == [3, 1, 2]
github IDSIA / sacred / tests / test_config / test_dogmatic_list.py View on Github external
def test_delslice():
    l = DogmaticList([1, 2, 3])
    del l[1:]
    assert l == [1, 2, 3]
github IDSIA / sacred / tests / test_config / test_dogmatic_list.py View on Github external
def test_list_interface_count():
    l = DogmaticList([1, 2, 4, 4, 5])
    assert l.count(1) == 1
    assert l.count(3) == 0
    assert l.count(4) == 2
github IDSIA / sacred / tests / test_config / test_dogmatic_list.py View on Github external
def test_list_interface_getitem():
    l = DogmaticList([0, 1, 2])
    assert l[0] == 0
    assert l[1] == 1
    assert l[2] == 2

    assert l[-1] == 2
    assert l[-2] == 1
    assert l[-3] == 0
github IDSIA / sacred / tests / test_config / test_dogmatic_list.py View on Github external
def test_extend():
    l = DogmaticList([1, 2])
    l.extend([3, 4])
    assert l == [1, 2]
github IDSIA / sacred / tests / test_config / test_dogmatic_list.py View on Github external
def test_empty_revelation():
    l = DogmaticList([1, 2, 3])
    assert l.revelation() == set()
github IDSIA / sacred / tests / test_config / test_dogmatic_list.py View on Github external
def test_imul():
    l = DogmaticList([1, 2])
    l *= 4
    assert l == [1, 2]