# Path: pre_commit_hooks/check_yaml.py
# def main(argv: Sequence[str] | None = None) -> int:
#     parser = argparse.ArgumentParser()
#     parser.add_argument(
#         '-m', '--multi', '--allow-multiple-documents', action='store_true',
#     )
#     parser.add_argument(
#         '--unsafe', action='store_true',
#         help=(
#             'Instead of loading the files, simply parse them for syntax.  '
#             'A syntax-only check enables extensions and unsafe contstructs '
#             'which would otherwise be forbidden.  Using this option removes '
#             'all guarantees of portability to other yaml implementations.  '
#             'Implies --allow-multiple-documents'
#         ),
#     )
#     parser.add_argument('filenames', nargs='*', help='Filenames to check.')
#     args = parser.parse_args(argv)
# 
#     load_fn = LOAD_FNS[Key(multi=args.multi, unsafe=args.unsafe)]
# 
#     retval = 0
#     for filename in args.filenames:
#         try:
#             with open(filename, encoding='UTF-8') as f:
#                 load_fn(f)
#         except ruamel.yaml.YAMLError as exc:
#             print(exc)
#             retval = 1
#     return retval
# 
# Path: testing/util.py
# def get_resource_path(path):
#     return os.path.join(TESTING_DIR, 'resources', path)


import pytest
from pre_commit_hooks.check_yaml import main
from testing.util import get_resource_path
from __future__ import annotations




@pytest.mark.parametrize(
    ('filename', 'expected_retval'), (
        ('bad_yaml.notyaml', 1),
        ('ok_yaml.yaml', 0),
    ),
)
def test_main(filename, expected_retval):

# Path: pre_commit_hooks/check_yaml.py
# def main(argv: Sequence[str] | None = None) -> int:
#     parser = argparse.ArgumentParser()
#     parser.add_argument(
#         '-m', '--multi', '--allow-multiple-documents', action='store_true',
#     )
#     parser.add_argument(
#         '--unsafe', action='store_true',
#         help=(
#             'Instead of loading the files, simply parse them for syntax.  '
#             'A syntax-only check enables extensions and unsafe contstructs '
#             'which would otherwise be forbidden.  Using this option removes '
#             'all guarantees of portability to other yaml implementations.  '
#             'Implies --allow-multiple-documents'
#         ),
#     )
#     parser.add_argument('filenames', nargs='*', help='Filenames to check.')
#     args = parser.parse_args(argv)
# 
#     load_fn = LOAD_FNS[Key(multi=args.multi, unsafe=args.unsafe)]
# 
#     retval = 0
#     for filename in args.filenames:
#         try:
#             with open(filename, encoding='UTF-8') as f:
#                 load_fn(f)
#         except ruamel.yaml.YAMLError as exc:
#             print(exc)
#             retval = 1
#     return retval
# 
# Path: testing/util.py
# def get_resource_path(path):
#     return os.path.join(TESTING_DIR, 'resources', path)


# Path: tests/check_yaml_test.py
import pytest
from pre_commit_hooks.check_yaml import main
from testing.util import get_resource_path

from __future__ import annotations




@pytest.mark.parametrize(
    ('filename', 'expected_retval'), (
        ('bad_yaml.notyaml', 1),
        ('ok_yaml.yaml', 0),
    ),
)
def test_main(filename, expected_retval):

    ret = main([get_resource_path(filename)])