[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2023-07-18 10:45:13 +00:00
parent aaa58f760c
commit 49c8d589b2
3 changed files with 9 additions and 7 deletions

View file

@ -55,10 +55,11 @@ def main(argv: Sequence[str] | None = None) -> int:
parser.add_argument('filenames', nargs='*', help='Filenames to check.') parser.add_argument('filenames', nargs='*', help='Filenames to check.')
parser.add_argument( parser.add_argument(
'--allow_duplicate_keys', '--allow-duplicate-keys', action='store_true', '--allow_duplicate_keys', '--allow-duplicate-keys', action='store_true',
help=('In JSON mapping keys should be unique, in YAML they must be unique.' help=(
'PyYAML never enforced this although the YAML 1.1 specification already required this.' 'In JSON mapping keys should be unique, in YAML they must be unique.'
'Duplicate keys in mappings are no longer allowed by default.' 'PyYAML never enforced this although the YAML 1.1 specification already required this.'
'Use this parameter to allow duplicate keys in yaml files.' 'Duplicate keys in mappings are no longer allowed by default.'
'Use this parameter to allow duplicate keys in yaml files.'
), ),
) )

View file

@ -27,6 +27,7 @@ def test_main_allow_multiple_documents(tmpdir):
# should pass when we allow multiple documents # should pass when we allow multiple documents
assert not main(('--allow-multiple-documents', str(f))) assert not main(('--allow-multiple-documents', str(f)))
def test_main_allow_duplicate_keys(tmpdir): def test_main_allow_duplicate_keys(tmpdir):
f = get_resource_path('duplicate_key_yaml.notyaml') f = get_resource_path('duplicate_key_yaml.notyaml')
# should fail by default # should fail by default