Deepcopy defaults to prevent weird references in yaml.

This commit is contained in:
Anthony Sottile 2014-04-03 21:53:31 -07:00
parent 5a7044edcc
commit 817ec510c7
2 changed files with 10 additions and 1 deletions

View file

@ -49,3 +49,10 @@ def test_apply_defaults_deep():
},
)
assert ret == {'foo': {'bar': {'baz': 'herp'}}}
def test_apply_defaults_copies():
schema = {'properties': {'foo': {'default': []}}}
ret1 = apply_defaults({}, schema)
ret2 = apply_defaults({}, schema)
assert ret1['foo'] is not ret2['foo']