Skip to content

Commit

Permalink
Merge b6e6735 into 8b73c80
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjpfan committed Jul 10, 2018
2 parents 8b73c80 + b6e6735 commit 498d634
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sacred/config/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def recursive_fill_in(config, preset):
for key in preset:
if key not in config:
config[key] = preset[key]
elif isinstance(config[key], dict):
elif isinstance(config[key], dict) and isinstance(preset[key], dict):
recursive_fill_in(config[key], preset[key])


Expand Down
17 changes: 17 additions & 0 deletions tests/test_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,23 @@ def main(empty_dict=1, nested_empty_dict=2):
assert ex.run(named_configs=['ncfg']).result == ({}, {'k1': {'k2': {}}})


def test_empty_dict_config_updates(ex):
@ex.config
def cfg():
a = 1

@ex.config
def default():
a = {'b': 1}

@ex.main
def main():
pass

r = ex.run()
assert r.config['a']['b'] == 1


def test_named_config_and_ingredient():
ing = Ingredient('foo')

Expand Down

0 comments on commit 498d634

Please sign in to comment.