# Path: pre_commit_hooks/check_toml.py
# def main(argv: Sequence[str] | None = None) -> int:
#     parser = argparse.ArgumentParser()
#     parser.add_argument('filenames', nargs='*', help='Filenames to check.')
#     args = parser.parse_args(argv)
# 
#     retval = 0
#     for filename in args.filenames:
#         try:
#             toml.load(filename)
#         except toml.TomlDecodeError as exc:
#             print(f'{filename}: {exc}')
#             retval = 1
#     return retval


from pre_commit_hooks.check_toml import main
from __future__ import annotations



def test_toml_bad(tmpdir):
    filename = tmpdir.join('f')
    filename.write("""
key = # INVALID

= "no key name"  # INVALID
""")

# Path: pre_commit_hooks/check_toml.py
# def main(argv: Sequence[str] | None = None) -> int:
#     parser = argparse.ArgumentParser()
#     parser.add_argument('filenames', nargs='*', help='Filenames to check.')
#     args = parser.parse_args(argv)
# 
#     retval = 0
#     for filename in args.filenames:
#         try:
#             toml.load(filename)
#         except toml.TomlDecodeError as exc:
#             print(f'{filename}: {exc}')
#             retval = 1
#     return retval


# Path: tests/check_toml_test.py
from pre_commit_hooks.check_toml import main

from __future__ import annotations



def test_toml_bad(tmpdir):
    filename = tmpdir.join('f')
    filename.write("""
key = # INVALID

= "no key name"  # INVALID
""")

    ret = main((str(filename),))