mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Deepcopy defaults to prevent weird references in yaml.
This commit is contained in:
parent
5a7044edcc
commit
817ec510c7
2 changed files with 10 additions and 1 deletions
|
|
@ -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']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue