How to use sacred - 10 common examples

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 daviddiazvico / scikit-datasets / tests / utils / test_experiment.py View on Github external
def _experiment(inner_cv, outer_cv):
    e = experiment(_dataset, _estimator)
    e.observers.append(FileStorageObserver('.results'))
    e.run(config_updates={'dataset': {'inner_cv': inner_cv,
                                      'outer_cv': outer_cv}})
github IDSIA / sacred / tests / test_config / test_signature.py View on Github external
def test_construct_arguments_with_kwargs_for_posargs_does_not_raise():
    Signature(bariza).construct_arguments([], {'a': 4, 'b': 3, 'c': 2}, {})
    s = Signature(FunCTIonWithCAPItals)
    s.construct_arguments([], {'a': 4, 'b': 3, 'c': 2, 'd': 6}, {})
github IDSIA / sacred / tests / test_config / test_signature.py View on Github external
def test_construct_arguments_with_kwargswildcard_doesnt_raise():
    kwargs = {'zimbabwe': 23}
    Signature(__double_underscore__).construct_arguments([1, 2], kwargs, {})
    Signature(FunCTIonWithCAPItals).construct_arguments(
        [1, 2, 3], kwargs, {})
github IDSIA / sacred / tests / test_config / test_signature.py View on Github external
def test_constructor_extract_function_name(function, name):
        s = Signature(function)
        assert s.name == name
github IDSIA / sacred / tests / test_config / test_signature.py View on Github external
def test_unicode_(func, expected):
    assert str(Signature(func)) == expected
github IDSIA / sacred / tests / test_config / test_signature.py View on Github external
def test_construct_arguments_does_not_overwrite_args_and_kwargs():
    s = Signature(bariza)
    args, kwargs = s.construct_arguments([1, 2], {'c': 3},
                                         {'a': 6, 'b': 6, 'c': 6})
    assert args == [1, 2]
    assert kwargs == {'c': 3}
github IDSIA / sacred / tests / test_config / test_signature.py View on Github external
def test_unicode_special():
    str_signature = "complex_function_name(a=5, b='fo', c=9)"
    assert str_signature in str(Signature(complex_function_name))
github IDSIA / sacred / tests / test_config / test_signature.py View on Github external
def test_construct_arguments_completes_kwargs_from_options():
    s = Signature(bariza)
    args, kwargs = s.construct_arguments([2, 4], {}, {"c": 6})
    assert args == [2, 4]
    assert kwargs == {"c": 6}
    s = Signature(complex_function_name)
    args, kwargs = s.construct_arguments([], {"c": 6, "b": 7}, {"a": 1})
    assert args == []
    assert kwargs == {"a": 1, "c": 6, "b": 7}

    s = Signature(_name_with_underscore_)
    args, kwargs = s.construct_arguments([], {}, {"fo": 7, "bar": 6})
    assert args == []
    assert kwargs == {"fo": 7, "bar": 6}
github IDSIA / sacred / tests / test_config / test_signature.py View on Github external
def test_construct_arguments_with_duplicate_args_raises_typeerror():
    multiple_values = re.compile(".*multiple values.*")
    with pytest.raises(TypeError) as excinfo:
        s = Signature(bariza)
        s.construct_arguments([1, 2, 3], {'a': 4, 'b': 5}, {})
    assert multiple_values.match(excinfo.value.args[0])
    with pytest.raises(TypeError) as excinfo:
        s = Signature(complex_function_name)
        s.construct_arguments([1], {'a': 4}, {})
    assert multiple_values.match(excinfo.value.args[0])
    with pytest.raises(TypeError) as excinfo:
        s = Signature(FunCTIonWithCAPItals)
        s.construct_arguments([1, 2, 3], {'c': 6}, {})
    assert multiple_values.match(excinfo.value.args[0])