test: test check-yaml feature that allows key duplicates.

This commit is contained in:
Frerk Saxen 2023-07-18 12:07:29 +02:00
parent 85ef03e3b7
commit 119a8f3b2c
2 changed files with 9 additions and 0 deletions

View file

@ -0,0 +1,2 @@
hello: "world"
hello: "planet"

View file

@ -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')