# Path: pre_commit_hooks/file_contents_sorter.py
# FAIL = 1
# 
# Path: pre_commit_hooks/file_contents_sorter.py
# def main(argv: Sequence[str] | None = None) -> int:
#     parser = argparse.ArgumentParser()
#     parser.add_argument('filenames', nargs='+', help='Files to sort')
#     parser.add_argument(
#         '--ignore-case',
#         action='store_const',
#         const=bytes.lower,
#         default=None,
#         help='fold lower case to upper case characters',
#     )
#     parser.add_argument(
#         '--unique',
#         action='store_true',
#         help='ensure each line is unique',
#     )
#     args = parser.parse_args(argv)
# 
#     retv = PASS
# 
#     for arg in args.filenames:
#         with open(arg, 'rb+') as file_obj:
#             ret_for_file = sort_file_contents(
#                 file_obj, key=args.ignore_case, unique=args.unique,
#             )
# 
#             if ret_for_file:
#                 print(f'Sorting {arg}')
# 
#             retv |= ret_for_file
# 
#     return retv
# 
# Path: pre_commit_hooks/file_contents_sorter.py
# PASS = 0


import pytest
from pre_commit_hooks.file_contents_sorter import FAIL
from pre_commit_hooks.file_contents_sorter import main
from pre_commit_hooks.file_contents_sorter import PASS
        (
            b'Fie\nFoe\nfee\nfum\n',
            ['--unique'],
            PASS,
            b'Fie\nFoe\nfee\nfum\n',
        ),
        (
            b'Fie\nFie\nFoe\nfee\nfum\n',
            ['--unique'],
            FAIL,
            b'Fie\nFoe\nfee\nfum\n',
        ),
        (
            b'fee\nFie\nFoe\nfum\n',
            ['--unique', '--ignore-case'],
            PASS,
            b'fee\nFie\nFoe\nfum\n',
        ),
        (
            b'fee\nfee\nFie\nFoe\nfum\n',
            ['--unique', '--ignore-case'],
            FAIL,
            b'fee\nFie\nFoe\nfum\n',
        ),
    ),
)
def test_integration(input_s, argv, expected_retval, output, tmpdir):
    path = tmpdir.join('file.txt')
    path.write_binary(input_s)


# Path: pre_commit_hooks/file_contents_sorter.py
# FAIL = 1
# 
# Path: pre_commit_hooks/file_contents_sorter.py
# def main(argv: Sequence[str] | None = None) -> int:
#     parser = argparse.ArgumentParser()
#     parser.add_argument('filenames', nargs='+', help='Files to sort')
#     parser.add_argument(
#         '--ignore-case',
#         action='store_const',
#         const=bytes.lower,
#         default=None,
#         help='fold lower case to upper case characters',
#     )
#     parser.add_argument(
#         '--unique',
#         action='store_true',
#         help='ensure each line is unique',
#     )
#     args = parser.parse_args(argv)
# 
#     retv = PASS
# 
#     for arg in args.filenames:
#         with open(arg, 'rb+') as file_obj:
#             ret_for_file = sort_file_contents(
#                 file_obj, key=args.ignore_case, unique=args.unique,
#             )
# 
#             if ret_for_file:
#                 print(f'Sorting {arg}')
# 
#             retv |= ret_for_file
# 
#     return retv
# 
# Path: pre_commit_hooks/file_contents_sorter.py
# PASS = 0


# Path: tests/file_contents_sorter_test.py
import pytest
from pre_commit_hooks.file_contents_sorter import FAIL
from pre_commit_hooks.file_contents_sorter import main
from pre_commit_hooks.file_contents_sorter import PASS

        (
            b'Fie\nFoe\nfee\nfum\n',
            ['--unique'],
            PASS,
            b'Fie\nFoe\nfee\nfum\n',
        ),
        (
            b'Fie\nFie\nFoe\nfee\nfum\n',
            ['--unique'],
            FAIL,
            b'Fie\nFoe\nfee\nfum\n',
        ),
        (
            b'fee\nFie\nFoe\nfum\n',
            ['--unique', '--ignore-case'],
            PASS,
            b'fee\nFie\nFoe\nfum\n',
        ),
        (
            b'fee\nfee\nFie\nFoe\nfum\n',
            ['--unique', '--ignore-case'],
            FAIL,
            b'fee\nFie\nFoe\nfum\n',
        ),
    ),
)
def test_integration(input_s, argv, expected_retval, output, tmpdir):
    path = tmpdir.join('file.txt')
    path.write_binary(input_s)


    output_retval = main([str(path)] + argv)