mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-03-29 10:16:52 +00:00
test: test check-yaml feature that allows key duplicates.
This commit is contained in:
parent
85ef03e3b7
commit
119a8f3b2c
2 changed files with 9 additions and 0 deletions
2
testing/resources/duplicate_key_yaml.notyaml
Normal file
2
testing/resources/duplicate_key_yaml.notyaml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
hello: "world"
|
||||
hello: "planet"
|
||||
|
|
@ -27,6 +27,13 @@ def test_main_allow_multiple_documents(tmpdir):
|
|||
# should pass when we allow multiple documents
|
||||
assert not main(('--allow-multiple-documents', str(f)))
|
||||
|
||||
def test_main_allow_duplicate_keys(tmpdir):
|
||||
f = get_resource_path('duplicate_key_yaml.notyaml')
|
||||
# should fail by default
|
||||
assert main((str(f),))
|
||||
# should pass when we allow duplicate keys
|
||||
assert not main(('--allow-duplicate-keys', str(f)))
|
||||
|
||||
|
||||
def test_fails_even_with_allow_multiple_documents(tmpdir):
|
||||
f = tmpdir.join('test.yaml')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue