Вот код:
import dataclasses
import sys
from argparse import ArgumentParser, Namespace
from pathlib import Path
from typing import List, Optional, Union


@dataclasses.dataclass
class RecursionSettings:
    """Настройки рекурсии."""
    indent: int = 4
    prune: bool = False
    max_depth: Optional[int] = None
    extensions: List[str] = dataclasses.field(default_factory=list)
    output: Optional[Path] = None


def get_parser() -> ArgumentParser:
    """Получить парсер аргументов командной строки."""
    parser = ArgumentParser(
        prog="tree",
        description="Вывести деревовидное представление файловой системы."
    )
    parser.add_argument(
        "path",
        nargs="?",
        default=".",
        help="Путь к директории для отображения (по умолчанию текущая директория).",
        metavar="PATH"
    )
    parser.add_argument(
        "-i", "--indent",
        type=int,
        default=4,
        metavar="INT",
        help="Количество пробелов для отступа (по умолчанию 4)."
    )
    parser.add_argument(
        "-p", "--prune",
        action="store_true",
        help="Отключить вывод пустых директорий."
    )
    parser.add_argument(
        "-d", "--depth",
        type=int,
        default=None,
        metavar="N",
        help="Ограничить глубину отображения (0 - только корень)."
    )
    parser.add_argument(
        "-o", "--output",
        type=str,
        metavar="FILE",
        help="Перенаправить вывод в указанный файл."
    )
    parser.add_argument(
        "-e", "--extension",
        action="append",
        default=[],
        metavar="EXT",
        help="Фильтр по расширению файлов. Можно использовать несколько раз."
    )
    return parser


def has_valid_args(args: Namespace, parser: ArgumentParser) -> bool:
    """Проверить, что аргументы валидны."""
    # Проверка indent
    if args.indent <= 0:
        parser.error("Аргумент --indent должен быть положительным числом.")

    # Нормализация пути
    try:
        path = Path(args.path).expanduser().resolve(strict=True)
    except FileNotFoundError:
        parser.error(f"Путь '{args.path}' не существует.")
    except Exception:
        parser.error(f"Невозможно обработать путь '{args.path}'.")

    if not path.is_dir():
        parser.error(f"Путь '{path}' не является директорией.")

    return True


def normalize_extensions(extensions: List[str]) -> List[str]:
    """Нормализовать расширения: привести к нижнему регистру и добавить ведущую точку, если её нет."""
    normalized = []
    for ext in extensions:
        ext = ext.lower()
        if ext and not ext.startswith('.'):
            ext = '.' + ext
        normalized.append(ext)
    return normalized


def has_matching_files(path: Path, settings: RecursionSettings) -> bool:
    """
    Проверить, содержит ли директория файлы, соответствующие фильтру.
    Если extensions пусты, считаем, что все файлы подходят.
    Если extension == '', то файлы без расширения.
    """
    try:
        for entry in path.iterdir():
            if entry.is_symlink():
                continue
            if entry.is_dir():
                if has_matching_files(entry, settings):
                    return True
            elif entry.is_file():
                if not settings.extensions:
                    # Нет фильтра по расширениям, любой файл подходит
                    return True
                for ext in settings.extensions:
                    if ext == '' and entry.suffix == '':
                        return True
                    elif entry.name.lower().endswith(ext):
                        return True
    except PermissionError:
        return False  # Пропустить директории без доступа
    return False


def tree_traverse(
        path: Path,
        settings: RecursionSettings,
        current_depth: int,
        lines: List[str],
        prefix: str
) -> None:
    """
    Рекурсивно обойти директорию и собрать строки для вывода.
    """
    if settings.max_depth is not None and current_depth > settings.max_depth:
        return

    try:
        entries = list(path.iterdir())
    except PermissionError:
        return  # Пропустить директории без доступа

    # Исключить символические ссылки и специальные файлы
    entries = [e for e in entries if not e.is_symlink() and (e.is_dir() or e.is_file())]

    # Фильтрация по расширениям, если указано
    if settings.extensions:
        filtered_entries = []
        for entry in entries:
            if entry.is_dir():
                if has_matching_files(entry, settings):
                    filtered_entries.append(entry)
            elif entry.is_file():
                for ext in settings.extensions:
                    if ext == '' and entry.suffix == '':
                        filtered_entries.append(entry)
                        break
                    elif entry.name.lower().endswith(ext):
                        filtered_entries.append(entry)
                        break
        entries = filtered_entries

    # Разделение на директории и файлы
    dirs = sorted([e for e in entries if e.is_dir()], key=lambda x: x.name.lower())
    files = sorted([e for e in entries if e.is_file()], key=lambda x: x.name.lower())

    # Если prune включен и нет содержимого, пропустить директорию
    if settings.prune and not dirs and not files:
        return

    # Добавление директорий
    for entry in dirs:
        lines.append(f"{prefix}{' ' * settings.indent}{entry.name}/")
        tree_traverse(
            entry,
            settings,
            current_depth + 1,
            lines,
            prefix + ' ' * settings.indent
        )

    # Добавление файлов
    for file in files:
        lines.append(f"{prefix}{' ' * settings.indent}{file.name}")


def tree_output(path: Path, settings: RecursionSettings) -> List[str]:
    """Получить список строк, представляющих файловое древо."""
    lines = [str(path.resolve().as_posix()) + '/']
    tree_traverse(path, settings, current_depth=1, lines=lines, prefix='')
    return lines


def main(argv: Union[list[str], None] = None) -> None:
    """Запустить консольную утилиту."""
    parser = get_parser()
    args = parser.parse_args(argv)

    # Проверка аргументов
    has_valid_args(args, parser)

    # Нормализация пути
    path = Path(args.path).expanduser().resolve()

    # Нормализация расширений
    extensions = normalize_extensions(args.extension)

    # Настройки рекурсии
    settings = RecursionSettings(
        indent=args.indent,
        prune=args.prune or bool(extensions),
        max_depth=args.depth,
        extensions=extensions,
        output=Path(args.output) if args.output else None
    )

    # Получение файлового древа
    lines = tree_output(path, settings)

    # Подготовка текста для вывода
    output_text = '\n'.join(lines) + '\n'

    # Вывод
    if settings.output:
        output_path = settings.output
        if output_path.exists():
            if output_path.is_symlink() or not output_path.is_file():
                parser.error(
                    f"Output path '{output_path}' должен быть обычным файлом, но это {'символическая ссылка' if output_path.is_symlink() else 'не файл'}.")
        else:
            # Проверка существования родительской директории
            parent = output_path.parent
            if not parent.exists():
                parser.error(f"Родительская директория для выходного файла '{output_path}' не существует.")

        try:
            with output_path.open('w', encoding='utf-8') as f:
                f.write(output_text)
        except Exception as e:
            parser.error(f"Не удалось записать в файл '{output_path}': {e}")
    else:
        print(output_text, end='')


if __name__ == "__main__":
    main()
Вот ошибки:

/usr/bin/python3 /Applications/PyCharm.app/Contents/plugins/python/helpers/pycharm/_jb_pytest_runner.py --path /Users/aleksandrvoytsev/PycharmProjects/hw-2-deep-python-Kyronison/tree/test_public.py 
Testing started at 12:10 ...
Launching pytest with arguments /Users/aleksandrvoytsev/PycharmProjects/hw-2-deep-python-Kyronison/tree/test_public.py --no-header --no-summary -q in /Users/aleksandrvoytsev/PycharmProjects/hw-2-deep-python-Kyronison/tree

============================= test session starts ==============================
collecting ... collected 78 items

test_public.py::test__tree__01 PASSED                                    [  1%]
test_public.py::test__tree__02 PASSED                                    [  2%]
test_public.py::test__tree__03 PASSED                                    [  3%]
test_public.py::test__tree__symlink PASSED                               [  5%]
test_public.py::test__tree__multiple_symlinks PASSED                     [  6%]
test_public.py::test__tree__nested_symlinks PASSED                       [  7%]
test_public.py::test__tree__normalized_argument_path FAILED              [  8%]usage: tree [-h] [-i INT] [-p] [-d N] [-o FILE] [-e EXT] [PATH]
tree: error: Путь '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/6e4ae902-6184-4ef6-b0bb-bdbd272ae346/directory/dev/../..' не существует.

test_public.py:212 (test__tree__normalized_argument_path)
args = Namespace(path='/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/6e4ae902-6184-4ef6-b0bb-bdbd272ae346/directory/dev/../..', indent=4, prune=False, depth=None, output=None, extension=[])
parser = ArgumentParser(prog='tree', usage=None, description='Вывести деревовидное представление файловой системы.', formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True)

    def has_valid_args(args: Namespace, parser: ArgumentParser) -> bool:
        """Проверить, что аргументы валидны."""
        # Проверка indent
        if args.indent <= 0:
            parser.error("Аргумент --indent должен быть положительным числом.")
    
        # Нормализация пути
        try:
>           path = Path(args.path).expanduser().resolve(strict=True)

tree.py:74: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/pathlib.py:1205: in resolve
    s = self._flavour.resolve(self, strict=strict)
/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/pathlib.py:363: in resolve
    return _resolve(base, str(path)) or sep
/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/pathlib.py:347: in _resolve
    target = accessor.readlink(newpath)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pathlib._NormalAccessor object at 0x10316abe0>
path = '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/6e4ae902-6184-4ef6-b0bb-bdbd272ae346/directory'

    def readlink(self, path):
>       return os.readlink(path)
E       FileNotFoundError: [Errno 2] No such file or directory: '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/6e4ae902-6184-4ef6-b0bb-bdbd272ae346/directory'

/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/pathlib.py:452: FileNotFoundError

During handling of the above exception, another exception occurred:

sandbox = PosixPath('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/6e4ae902-6184-4ef6-b0bb-bdbd272ae346')
capsys = <_pytest.capture.CaptureFixture object at 0x104339250>

    def test__tree__normalized_argument_path(sandbox: Path, capsys: CaptureFixture) -> None:
        """Кейс: нормализация аргумента-пути."""
        file = sandbox / "file.txt"
        file.touch()
    
        # Равносильно `./` - остаемся в песочнице
        suffix = "./directory/dev///./.././/.././"
    
>       main([sandbox.joinpath(suffix).as_posix()])

test_public.py:221: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tree.py:199: in main
    has_valid_args(args, parser)
tree.py:76: in has_valid_args
    parser.error(f"Путь '{args.path}' не существует.")
/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/argparse.py:2575: in error
    self.exit(2, _('%(prog)s: error: %(message)s\n') % args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = ArgumentParser(prog='tree', usage=None, description='Вывести деревовидное представление файловой системы.', formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True)
status = 2
message = "tree: error: Путь '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/6e4ae902-6184-4ef6-b0bb-bdbd272ae346/directory/dev/../..' не существует.\n"

    def exit(self, status=0, message=None):
        if message:
            self._print_message(message, _sys.stderr)
>       _sys.exit(status)
E       SystemExit: 2

/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/argparse.py:2562: SystemExit

test_public.py::test__tree__default_path PASSED                          [ 10%]
test_public.py::test__tree__empty_directory PASSED                       [ 11%]
test_public.py::test__tree__help PASSED                                  [ 12%]
test_public.py::test__tree__indent__2[-i] 
test_public.py::test__tree__indent__2[--indent] 
test_public.py::test__tree__indent__8[-i] PASSED                         [ 14%]PASSED                   [ 15%]
test_public.py::test__tree__indent__8[--indent] 
test_public.py::test__tree__indent__non_positive[0--i] PASSED                         [ 16%]PASSED                   [ 17%]
test_public.py::test__tree__indent__non_positive[0---indent] 
test_public.py::test__tree__indent__non_positive[-1--i] 
test_public.py::test__tree__indent__non_positive[-1---indent] 
test_public.py::test__tree__indent__non_positive[-2--i] 
test_public.py::test__tree__indent__non_positive[-2---indent] 
test_public.py::test__tree__indent__non_positive[-4--i] 
test_public.py::test__tree__indent__non_positive[-4---indent] 
test_public.py::test__tree__prune__simple[-p] PASSED            [ 19%]PASSED      [ 20%]PASSED           [ 21%]PASSED     [ 23%]PASSED           [ 24%]PASSED     [ 25%]PASSED           [ 26%]PASSED     [ 28%]
test_public.py::test__tree__prune__simple[--prune] 
test_public.py::test__tree__prune__nested__01[-p] FAILED                     [ 29%]
test_public.py:396 (test__tree__prune__simple[-p])
('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/b633549d-8b63-4899-b09b-f3de9931b4e6/\n'
 '    directory/\n') != '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/b633549d-8b63-4899-b09b-f3de9931b4e6/\n'

<Click to see difference>

option = '-p'
sandbox = PosixPath('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/b633549d-8b63-4899-b09b-f3de9931b4e6')
capsys = <_pytest.capture.CaptureFixture object at 0x104564190>

    @pytest.mark.parametrize("option", ["-p", "--prune"])
    def test__tree__prune__simple(
        option: str, sandbox: Path, capsys: CaptureFixture
    ) -> None:
        """Кейс: исключение пустых директорий."""
        directory = sandbox / "directory"
        directory.mkdir()
    
        main([option, sandbox.as_posix()])
    
        captured = capsys.readouterr()
        stdout = captured.out
    
        expected = f"""\
        {sandbox.as_posix()}/
        """
    
>       assert stdout == dedent(expected)
E       AssertionError: assert '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/b633549d-8b63-4899-b09b-f3de9931b4e6/\n    directory/\n' == '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/b633549d-8b63-4899-b09b-f3de9931b4e6/\n'
E         
E           /private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/b633549d-8b63-4899-b09b-f3de9931b4e6/
E         +     directory/

test_public.py:414: AssertionError
FAILED                [ 30%]
test_public.py:396 (test__tree__prune__simple[--prune])
('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/a76ed5a5-3b55-45d4-a232-8d3321d9ddd7/\n'
 '    directory/\n') != '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/a76ed5a5-3b55-45d4-a232-8d3321d9ddd7/\n'

<Click to see difference>

option = '--prune'
sandbox = PosixPath('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/a76ed5a5-3b55-45d4-a232-8d3321d9ddd7')
capsys = <_pytest.capture.CaptureFixture object at 0x104541fa0>

    @pytest.mark.parametrize("option", ["-p", "--prune"])
    def test__tree__prune__simple(
        option: str, sandbox: Path, capsys: CaptureFixture
    ) -> None:
        """Кейс: исключение пустых директорий."""
        directory = sandbox / "directory"
        directory.mkdir()
    
        main([option, sandbox.as_posix()])
    
        captured = capsys.readouterr()
        stdout = captured.out
    
        expected = f"""\
        {sandbox.as_posix()}/
        """
    
>       assert stdout == dedent(expected)
E       AssertionError: assert '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/a76ed5a5-3b55-45d4-a232-8d3321d9ddd7/\n    directory/\n' == '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/a76ed5a5-3b55-45d4-a232-8d3321d9ddd7/\n'
E         
E           /private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/a76ed5a5-3b55-45d4-a232-8d3321d9ddd7/
E         +     directory/

test_public.py:414: AssertionError

test_public.py::test__tree__prune__nested__01[--prune] 
test_public.py::test__tree__prune__nested__02[-p] FAILED                 [ 32%]
test_public.py:416 (test__tree__prune__nested__01[-p])
('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/05c17ddd-fbba-40a1-a854-8cac686c043a/\n'
 '    directory/\n'
 '        empty_1/\n'
 '        empty_2/\n'
 '    file.txt\n') != ('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/05c17ddd-fbba-40a1-a854-8cac686c043a/\n'
 '    file.txt\n')

<Click to see difference>

option = '-p'
sandbox = PosixPath('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/05c17ddd-fbba-40a1-a854-8cac686c043a')
capsys = <_pytest.capture.CaptureFixture object at 0x104564d00>

    @pytest.mark.parametrize("option", ["-p", "--prune"])
    def test__tree__prune__nested__01(
        option: str, sandbox: Path, capsys: CaptureFixture
    ) -> None:
        """Кейс: исключение пустых вложенных директорий."""
        file = sandbox / "file.txt"
        file.touch()
    
        directory = sandbox / "directory"
        directory.mkdir()
    
        empty_directory_01 = directory / "empty_1"
        empty_directory_01.mkdir()
    
        empty_directory_02 = directory / "empty_2"
        empty_directory_02.mkdir()
    
        main([option, sandbox.as_posix()])
    
        captured = capsys.readouterr()
        stdout = captured.out
    
        expected = f"""\
        {sandbox.as_posix()}/
            file.txt
        """
    
>       assert stdout == dedent(expected)
E       AssertionError: assert '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/05c17ddd-fbba-40a1-a854-8cac686c043a/\n    directory/\n        empty_1/\n        empty_2/\n    file.txt\n' == '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/05c17ddd-fbba-40a1-a854-8cac686c043a/\n    file.txt\n'
E         
E           /private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/05c17ddd-fbba-40a1-a854-8cac686c043a/
E         +     directory/
E         +         empty_1/
E         +         empty_2/
E               file.txt

test_public.py:444: AssertionError
FAILED            [ 33%]
test_public.py:416 (test__tree__prune__nested__01[--prune])
('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/23169613-9dda-4c9d-add7-13626ac0f6c2/\n'
 '    directory/\n'
 '        empty_1/\n'
 '        empty_2/\n'
 '    file.txt\n') != ('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/23169613-9dda-4c9d-add7-13626ac0f6c2/\n'
 '    file.txt\n')

<Click to see difference>

option = '--prune'
sandbox = PosixPath('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/23169613-9dda-4c9d-add7-13626ac0f6c2')
capsys = <_pytest.capture.CaptureFixture object at 0x1044ef6a0>

    @pytest.mark.parametrize("option", ["-p", "--prune"])
    def test__tree__prune__nested__01(
        option: str, sandbox: Path, capsys: CaptureFixture
    ) -> None:
        """Кейс: исключение пустых вложенных директорий."""
        file = sandbox / "file.txt"
        file.touch()
    
        directory = sandbox / "directory"
        directory.mkdir()
    
        empty_directory_01 = directory / "empty_1"
        empty_directory_01.mkdir()
    
        empty_directory_02 = directory / "empty_2"
        empty_directory_02.mkdir()
    
        main([option, sandbox.as_posix()])
    
        captured = capsys.readouterr()
        stdout = captured.out
    
        expected = f"""\
        {sandbox.as_posix()}/
            file.txt
        """
    
>       assert stdout == dedent(expected)
E       AssertionError: assert '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/23169613-9dda-4c9d-add7-13626ac0f6c2/\n    directory/\n        empty_1/\n        empty_2/\n    file.txt\n' == '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/23169613-9dda-4c9d-add7-13626ac0f6c2/\n    file.txt\n'
E         
E           /private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/23169613-9dda-4c9d-add7-13626ac0f6c2/
E         +     directory/
E         +         empty_1/
E         +         empty_2/
E               file.txt

test_public.py:444: AssertionError
FAILED                 [ 34%]
test_public.py:446 (test__tree__prune__nested__02[-p])
('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/b877ab7d-e939-4d10-b94c-e86b7667eae9/\n'
 '    directory/\n'
 '        another_directory/\n'
 '            empty/\n'
 '            yet_another_directory/\n'
 '                file.txt\n'
 '        empty/\n'
 '    file.txt\n') != ('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/b877ab7d-e939-4d10-b94c-e86b7667eae9/\n'
 '    directory/\n'
 '        another_directory/\n'
 '            yet_another_directory/\n'
 '                file.txt\n'
 '    file.txt\n')

<Click to see difference>

option = '-p'
sandbox = PosixPath('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/b877ab7d-e939-4d10-b94c-e86b7667eae9')
capsys = <_pytest.capture.CaptureFixture object at 0x1044efe80>

    @pytest.mark.parametrize("option", ["-p", "--prune"])
    def test__tree__prune__nested__02(
        option: str, sandbox: Path, capsys: CaptureFixture
    ) -> None:
        """Кейс: исключение пустых вложенных директорий."""
        file = sandbox / "file.txt"
        file.touch()
    
        directory = sandbox / "directory"
        directory.mkdir()
    
        empty_directory = directory / "empty"
        empty_directory.mkdir()
    
        another_directory = directory / "another_directory"
        another_directory.mkdir()
    
        another_empty_directory = another_directory / "empty"
        another_empty_directory.mkdir()
    
        yet_another_directory = another_directory / "yet_another_directory"
        yet_another_directory.mkdir()
    
        yet_another_file = yet_another_directory / "file.txt"
        yet_another_file.touch()
    
        main([option, sandbox.as_posix()])
    
        captured = capsys.readouterr()
        stdout = captured.out
    
        expected = f"""\
        {sandbox.as_posix()}/
            directory/
                another_directory/
                    yet_another_directory/
                        file.txt
            file.txt
        """
    
>       assert stdout == dedent(expected)
E       AssertionError: assert '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/b877ab7d-e939-4d10-b94c-e86b7667eae9/\n    directory/\n        another_directory/\n            empty/\n            yet_another_directory/\n                file.txt\n        empty/\n    file.txt\n' == '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/b877ab7d-e939-4d10-b94c-e86b7667eae9/\n    directory/\n        another_directory/\n            yet_another_directory/\n                file.txt\n    file.txt\n'
E         
E           /private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/b877ab7d-e939-4d10-b94c-e86b7667eae9/
E               directory/
E                   another_directory/
E         +             empty/
E                       yet_another_directory/
E                           file.txt
E         +         empty/
E               file.txt

test_public.py:487: AssertionError

test_public.py::test__tree__prune__nested__02[--prune] FAILED            [ 35%]
test_public.py:446 (test__tree__prune__nested__02[--prune])
('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/87b8b312-6ade-4106-bca8-5d5bfea73f17/\n'
 '    directory/\n'
 '        another_directory/\n'
 '            empty/\n'
 '            yet_another_directory/\n'
 '                file.txt\n'
 '        empty/\n'
 '    file.txt\n') != ('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/87b8b312-6ade-4106-bca8-5d5bfea73f17/\n'
 '    directory/\n'
 '        another_directory/\n'
 '            yet_another_directory/\n'
 '                file.txt\n'
 '    file.txt\n')

<Click to see difference>

option = '--prune'
sandbox = PosixPath('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/87b8b312-6ade-4106-bca8-5d5bfea73f17')
capsys = <_pytest.capture.CaptureFixture object at 0x1047995b0>

    @pytest.mark.parametrize("option", ["-p", "--prune"])
    def test__tree__prune__nested__02(
        option: str, sandbox: Path, capsys: CaptureFixture
    ) -> None:
        """Кейс: исключение пустых вложенных директорий."""
        file = sandbox / "file.txt"
        file.touch()
    
        directory = sandbox / "directory"
        directory.mkdir()
    
        empty_directory = directory / "empty"
        empty_directory.mkdir()
    
        another_directory = directory / "another_directory"
        another_directory.mkdir()
    
        another_empty_directory = another_directory / "empty"
        another_empty_directory.mkdir()
    
        yet_another_directory = another_directory / "yet_another_directory"
        yet_another_directory.mkdir()
    
        yet_another_file = yet_another_directory / "file.txt"
        yet_another_file.touch()
    
        main([option, sandbox.as_posix()])
    
        captured = capsys.readouterr()
        stdout = captured.out
    
        expected = f"""\
        {sandbox.as_posix()}/
            directory/
                another_directory/
                    yet_another_directory/
                        file.txt
            file.txt
        """
    
>       assert stdout == dedent(expected)
E       AssertionError: assert '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/87b8b312-6ade-4106-bca8-5d5bfea73f17/\n    directory/\n        another_directory/\n            empty/\n            yet_another_directory/\n                file.txt\n        empty/\n    file.txt\n' == '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/87b8b312-6ade-4106-bca8-5d5bfea73f17/\n    directory/\n        another_directory/\n            yet_another_directory/\n                file.txt\n    file.txt\n'
E         
E           /private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/87b8b312-6ade-4106-bca8-5d5bfea73f17/
E               directory/
E                   another_directory/
E         +             empty/
E                       yet_another_directory/
E                           file.txt
E         +         empty/
E               file.txt

test_public.py:487: AssertionError

test_public.py::test__tree__prune__nested__03[-p] 
test_public.py::test__tree__prune__nested__03[--prune] 
test_public.py::test__tree__limited_depth__0[-d] FAILED                 [ 37%]
test_public.py:489 (test__tree__prune__nested__03[-p])
('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/09e9b73d-cbaf-45e8-a895-cebbee6f78e8/\n'
 '    directory/\n'
 '        another_directory/\n'
 '            empty/\n'
 '            yet_another_directory/\n'
 '                file.txt\n'
 '        empty/\n'
 '    file.txt\n') != ('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/09e9b73d-cbaf-45e8-a895-cebbee6f78e8/\n'
 '    directory/\n'
 '        another_directory/\n'
 '            yet_another_directory/\n'
 '                file.txt\n'
 '    file.txt\n')

<Click to see difference>

option = '-p'
sandbox = PosixPath('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/09e9b73d-cbaf-45e8-a895-cebbee6f78e8')
capsys = <_pytest.capture.CaptureFixture object at 0x10462b9d0>

    @pytest.mark.parametrize("option", ["-p", "--prune"])
    def test__tree__prune__nested__03(
        option: str, sandbox: Path, capsys: CaptureFixture
    ) -> None:
        """Кейс: исключение пустых вложенных директорий."""
        file = sandbox / "file.txt"
        file.touch()
    
        directory = sandbox / "directory"
        directory.mkdir()
    
        empty_directory = directory / "empty"
        empty_directory.mkdir()
    
        another_directory = directory / "another_directory"
        another_directory.mkdir()
    
        another_empty_directory = another_directory / "empty"
        another_empty_directory.mkdir()
    
        yet_another_directory = another_directory / "yet_another_directory"
        yet_another_directory.mkdir()
    
        yet_another_file = yet_another_directory / "file.txt"
        yet_another_file.touch()
    
        main([option, sandbox.as_posix()])
    
        captured = capsys.readouterr()
        stdout = captured.out
    
        expected = f"""\
        {sandbox.as_posix()}/
            directory/
                another_directory/
                    yet_another_directory/
                        file.txt
            file.txt
        """
    
>       assert stdout == dedent(expected)
E       AssertionError: assert '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/09e9b73d-cbaf-45e8-a895-cebbee6f78e8/\n    directory/\n        another_directory/\n            empty/\n            yet_another_directory/\n                file.txt\n        empty/\n    file.txt\n' == '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/09e9b73d-cbaf-45e8-a895-cebbee6f78e8/\n    directory/\n        another_directory/\n            yet_another_directory/\n                file.txt\n    file.txt\n'
E         
E           /private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/09e9b73d-cbaf-45e8-a895-cebbee6f78e8/
E               directory/
E                   another_directory/
E         +             empty/
E                       yet_another_directory/
E                           file.txt
E         +         empty/
E               file.txt

test_public.py:530: AssertionError
FAILED            [ 38%]
test_public.py:489 (test__tree__prune__nested__03[--prune])
('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/3419eee6-12b2-4cf3-812b-5439e5c84712/\n'
 '    directory/\n'
 '        another_directory/\n'
 '            empty/\n'
 '            yet_another_directory/\n'
 '                file.txt\n'
 '        empty/\n'
 '    file.txt\n') != ('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/3419eee6-12b2-4cf3-812b-5439e5c84712/\n'
 '    directory/\n'
 '        another_directory/\n'
 '            yet_another_directory/\n'
 '                file.txt\n'
 '    file.txt\n')

<Click to see difference>

option = '--prune'
sandbox = PosixPath('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/3419eee6-12b2-4cf3-812b-5439e5c84712')
capsys = <_pytest.capture.CaptureFixture object at 0x1044c2f70>

    @pytest.mark.parametrize("option", ["-p", "--prune"])
    def test__tree__prune__nested__03(
        option: str, sandbox: Path, capsys: CaptureFixture
    ) -> None:
        """Кейс: исключение пустых вложенных директорий."""
        file = sandbox / "file.txt"
        file.touch()
    
        directory = sandbox / "directory"
        directory.mkdir()
    
        empty_directory = directory / "empty"
        empty_directory.mkdir()
    
        another_directory = directory / "another_directory"
        another_directory.mkdir()
    
        another_empty_directory = another_directory / "empty"
        another_empty_directory.mkdir()
    
        yet_another_directory = another_directory / "yet_another_directory"
        yet_another_directory.mkdir()
    
        yet_another_file = yet_another_directory / "file.txt"
        yet_another_file.touch()
    
        main([option, sandbox.as_posix()])
    
        captured = capsys.readouterr()
        stdout = captured.out
    
        expected = f"""\
        {sandbox.as_posix()}/
            directory/
                another_directory/
                    yet_another_directory/
                        file.txt
            file.txt
        """
    
>       assert stdout == dedent(expected)
E       AssertionError: assert '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/3419eee6-12b2-4cf3-812b-5439e5c84712/\n    directory/\n        another_directory/\n            empty/\n            yet_another_directory/\n                file.txt\n        empty/\n    file.txt\n' == '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/3419eee6-12b2-4cf3-812b-5439e5c84712/\n    directory/\n        another_directory/\n            yet_another_directory/\n                file.txt\n    file.txt\n'
E         
E           /private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/3419eee6-12b2-4cf3-812b-5439e5c84712/
E               directory/
E                   another_directory/
E         +             empty/
E                       yet_another_directory/
E                           file.txt
E         +         empty/
E               file.txt

test_public.py:530: AssertionError

test_public.py::test__tree__limited_depth__0[--depth] 
test_public.py::test__tree__limited_depth__1[-d] PASSED                  [ 39%]PASSED             [ 41%]
test_public.py::test__tree__limited_depth__1[--depth] 
test_public.py::test__tree__limited_depth__2[-d] PASSED                  [ 42%]PASSED             [ 43%]
test_public.py::test__tree__limited_depth__2[--depth] 
test_public.py::test__tree__limited_depth__3[-d] PASSED                  [ 44%]PASSED             [ 46%]
test_public.py::test__tree__limited_depth__3[--depth] 
test_public.py::test__tree__redirect_output[-o] PASSED                  [ 47%]PASSED             [ 48%]
test_public.py::test__tree__redirect_output[--output] 
test_public.py::test__tree__redirect_output__overwrite[-o] FAILED                   [ 50%]
test_public.py:693 (test__tree__redirect_output[-o])
'/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/d1ffac60-9449-4006-85bf-d7e91f2c4c1d/\n' != ('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/d1ffac60-9449-4006-85bf-d7e91f2c4c1d/\n'
 '    file.txt\n')

<Click to see difference>

option = '-o'
sandbox = PosixPath('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/d1ffac60-9449-4006-85bf-d7e91f2c4c1d')
capsys = <_pytest.capture.CaptureFixture object at 0x104320c70>

    @pytest.mark.parametrize("option", ["-o", "--output"])
    def test__tree__redirect_output(
        option: str, sandbox: Path, capsys: CaptureFixture
    ) -> None:
        """Кейс: перенаправить вывод в файл."""
        filename = "file.txt"
    
        with cd(sandbox):
            main([option, f"./{filename}", sandbox.as_posix()])
    
        captured = capsys.readouterr()
        stdout = captured.out
    
        expected = f"""\
        {sandbox.as_posix()}/
            file.txt
        """
    
        file = sandbox / filename
        contents = file.read_text()
    
        assert stdout == ""
>       assert contents == dedent(expected)
E       AssertionError: assert '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/d1ffac60-9449-4006-85bf-d7e91f2c4c1d/\n' == '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/d1ffac60-9449-4006-85bf-d7e91f2c4c1d/\n    file.txt\n'
E         
E           /private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/d1ffac60-9449-4006-85bf-d7e91f2c4c1d/
E         -     file.txt

test_public.py:716: AssertionError
FAILED             [ 51%]
test_public.py:693 (test__tree__redirect_output[--output])
'/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/f1f98bfb-3966-4aae-b690-f1acbaea1c25/\n' != ('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/f1f98bfb-3966-4aae-b690-f1acbaea1c25/\n'
 '    file.txt\n')

<Click to see difference>

option = '--output'
sandbox = PosixPath('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/f1f98bfb-3966-4aae-b690-f1acbaea1c25')
capsys = <_pytest.capture.CaptureFixture object at 0x104389580>

    @pytest.mark.parametrize("option", ["-o", "--output"])
    def test__tree__redirect_output(
        option: str, sandbox: Path, capsys: CaptureFixture
    ) -> None:
        """Кейс: перенаправить вывод в файл."""
        filename = "file.txt"
    
        with cd(sandbox):
            main([option, f"./{filename}", sandbox.as_posix()])
    
        captured = capsys.readouterr()
        stdout = captured.out
    
        expected = f"""\
        {sandbox.as_posix()}/
            file.txt
        """
    
        file = sandbox / filename
        contents = file.read_text()
    
        assert stdout == ""
>       assert contents == dedent(expected)
E       AssertionError: assert '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/f1f98bfb-3966-4aae-b690-f1acbaea1c25/\n' == '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/f1f98bfb-3966-4aae-b690-f1acbaea1c25/\n    file.txt\n'
E         
E           /private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/f1f98bfb-3966-4aae-b690-f1acbaea1c25/
E         -     file.txt

test_public.py:716: AssertionError

test_public.py::test__tree__redirect_output__overwrite[--output] 
test_public.py::test__tree__redirect_output__directory[-o] PASSED        [ 52%]PASSED  [ 53%]
test_public.py::test__tree__redirect_output__directory[--output] 
test_public.py::test__tree__redirect_output__symlink_to_file[-o] PASSED        [ 55%]PASSED  [ 56%]
test_public.py::test__tree__redirect_output__symlink_to_file[--output] 
test_public.py::test__tree__filter_by_extension[-e] PASSED  [ 57%]PASSED [ 58%]
test_public.py::test__tree__filter_by_extension[--extension] 
test_public.py::test__tree__filter_by_extension__no_dot[-e] PASSED               [ 60%]PASSED      [ 61%]PASSED       [ 62%]
test_public.py::test__tree__filter_by_extension__no_dot[--extension] PASSED [ 64%]
test_public.py::test__tree__filter_by_extension__empty_string[-e] 
test_public.py::test__tree__filter_by_extension__empty_string[--extension] 
test_public.py::test__tree__filter_by_extension__multidot_extension__01[-e] FAILED [ 65%]
test_public.py:845 (test__tree__filter_by_extension__empty_string[-e])
('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/07a1570f-ec5e-440e-84ae-b2093d25a932/\n'
 '    file\n'
 '    file.md\n'
 '    file.txt\n') != ('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/07a1570f-ec5e-440e-84ae-b2093d25a932/\n'
 '    file\n')

<Click to see difference>

option = '-e'
sandbox = PosixPath('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/07a1570f-ec5e-440e-84ae-b2093d25a932')
capsys = <_pytest.capture.CaptureFixture object at 0x1042703d0>

    @pytest.mark.parametrize("option", ["-e", "--extension"])
    def test__tree__filter_by_extension__empty_string(
        option: str, sandbox: Path, capsys: CaptureFixture
    ) -> None:
        """Кейс: пустое расширение."""
        file = sandbox / "file.txt"
        file.touch()
    
        another_file = sandbox / "file.md"
        another_file.touch()
    
        yet_another_file = sandbox / "file"
        yet_another_file.touch()
    
        main([option, "", sandbox.as_posix()])
    
        captured = capsys.readouterr()
        stdout = captured.out
    
        expected = f"""\
        {sandbox.as_posix()}/
            file
        """
    
>       assert stdout == dedent(expected)
E       AssertionError: assert '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/07a1570f-ec5e-440e-84ae-b2093d25a932/\n    file\n    file.md\n    file.txt\n' == '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/07a1570f-ec5e-440e-84ae-b2093d25a932/\n    file\n'
E         
E           /private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/07a1570f-ec5e-440e-84ae-b2093d25a932/
E               file
E         +     file.md
E         +     file.txt

test_public.py:870: AssertionError
FAILED [ 66%]
test_public.py:845 (test__tree__filter_by_extension__empty_string[--extension])
('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/00afde20-77c0-4c7a-b43d-ad24b013f087/\n'
 '    file\n'
 '    file.md\n'
 '    file.txt\n') != ('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/00afde20-77c0-4c7a-b43d-ad24b013f087/\n'
 '    file\n')

<Click to see difference>

option = '--extension'
sandbox = PosixPath('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/00afde20-77c0-4c7a-b43d-ad24b013f087')
capsys = <_pytest.capture.CaptureFixture object at 0x104351c70>

    @pytest.mark.parametrize("option", ["-e", "--extension"])
    def test__tree__filter_by_extension__empty_string(
        option: str, sandbox: Path, capsys: CaptureFixture
    ) -> None:
        """Кейс: пустое расширение."""
        file = sandbox / "file.txt"
        file.touch()
    
        another_file = sandbox / "file.md"
        another_file.touch()
    
        yet_another_file = sandbox / "file"
        yet_another_file.touch()
    
        main([option, "", sandbox.as_posix()])
    
        captured = capsys.readouterr()
        stdout = captured.out
    
        expected = f"""\
        {sandbox.as_posix()}/
            file
        """
    
>       assert stdout == dedent(expected)
E       AssertionError: assert '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/00afde20-77c0-4c7a-b43d-ad24b013f087/\n    file\n    file.md\n    file.txt\n' == '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/00afde20-77c0-4c7a-b43d-ad24b013f087/\n    file\n'
E         
E           /private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/00afde20-77c0-4c7a-b43d-ad24b013f087/
E               file
E         +     file.md
E         +     file.txt

test_public.py:870: AssertionError

test_public.py::test__tree__filter_by_extension__multidot_extension__01[--extension] 
test_public.py::test__tree__filter_by_extension__multidot_extension__02[-e] PASSED [ 67%]PASSED [ 69%]
test_public.py::test__tree__filter_by_extension__multidot_extension__02[--extension] 
test_public.py::test__tree__filter_by_extension__starts_with_dot__01[-e] FAILED [ 70%]
test_public.py:893 (test__tree__filter_by_extension__multidot_extension__02[-e])
('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/8f9ee954-7f04-45cb-ba04-77e0a05696ff/\n'
 '    file.tar.gz\n') != '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/8f9ee954-7f04-45cb-ba04-77e0a05696ff/\n'

<Click to see difference>

option = '-e'
sandbox = PosixPath('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/8f9ee954-7f04-45cb-ba04-77e0a05696ff')
capsys = <_pytest.capture.CaptureFixture object at 0x104351610>

    @pytest.mark.parametrize("option", ["-e", "--extension"])
    def test__tree__filter_by_extension__multidot_extension__02(
        option: str, sandbox: Path, capsys: CaptureFixture
    ) -> None:
        """Кейс: многоуровневое расширение."""
        file = sandbox / "file.tar.gz"
        file.touch()
    
        main([option, ".gz", sandbox.as_posix()])
    
        captured = capsys.readouterr()
        stdout = captured.out
    
        expected = f"""\
        {sandbox.as_posix()}/
        """
    
>       assert stdout == dedent(expected)
E       AssertionError: assert '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/8f9ee954-7f04-45cb-ba04-77e0a05696ff/\n    file.tar.gz\n' == '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/8f9ee954-7f04-45cb-ba04-77e0a05696ff/\n'
E         
E           /private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/8f9ee954-7f04-45cb-ba04-77e0a05696ff/
E         +     file.tar.gz

test_public.py:911: AssertionError
FAILED [ 71%]
test_public.py:893 (test__tree__filter_by_extension__multidot_extension__02[--extension])
('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/57503422-1540-447d-a1a0-7fee6954cbd9/\n'
 '    file.tar.gz\n') != '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/57503422-1540-447d-a1a0-7fee6954cbd9/\n'

<Click to see difference>

option = '--extension'
sandbox = PosixPath('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/57503422-1540-447d-a1a0-7fee6954cbd9')
capsys = <_pytest.capture.CaptureFixture object at 0x1042d02b0>

    @pytest.mark.parametrize("option", ["-e", "--extension"])
    def test__tree__filter_by_extension__multidot_extension__02(
        option: str, sandbox: Path, capsys: CaptureFixture
    ) -> None:
        """Кейс: многоуровневое расширение."""
        file = sandbox / "file.tar.gz"
        file.touch()
    
        main([option, ".gz", sandbox.as_posix()])
    
        captured = capsys.readouterr()
        stdout = captured.out
    
        expected = f"""\
        {sandbox.as_posix()}/
        """
    
>       assert stdout == dedent(expected)
E       AssertionError: assert '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/57503422-1540-447d-a1a0-7fee6954cbd9/\n    file.tar.gz\n' == '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/57503422-1540-447d-a1a0-7fee6954cbd9/\n'
E         
E           /private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/57503422-1540-447d-a1a0-7fee6954cbd9/
E         +     file.tar.gz

test_public.py:911: AssertionError

test_public.py::test__tree__filter_by_extension__starts_with_dot__01[--extension] 
test_public.py::test__tree__filter_by_extension__starts_with_dot__02[-e] FAILED [ 73%]
test_public.py:913 (test__tree__filter_by_extension__starts_with_dot__01[-e])
('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/0396fc53-d3f9-4e9a-b591-413e704abb7b/\n'
 '    .gitignore\n') != '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/0396fc53-d3f9-4e9a-b591-413e704abb7b/\n'

<Click to see difference>

option = '-e'
sandbox = PosixPath('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/0396fc53-d3f9-4e9a-b591-413e704abb7b')
capsys = <_pytest.capture.CaptureFixture object at 0x1043208b0>

    @pytest.mark.parametrize("option", ["-e", "--extension"])
    def test__tree__filter_by_extension__starts_with_dot__01(
        option: str, sandbox: Path, capsys: CaptureFixture
    ) -> None:
        """Кейс: многоуровневое расширение."""
        file = sandbox / ".gitignore"
        file.touch()
    
        main([option, ".gitignore", sandbox.as_posix()])
    
        captured = capsys.readouterr()
        stdout = captured.out
    
        expected = f"""\
        {sandbox.as_posix()}/
        """
    
>       assert stdout == dedent(expected)
E       AssertionError: assert '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/0396fc53-d3f9-4e9a-b591-413e704abb7b/\n    .gitignore\n' == '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/0396fc53-d3f9-4e9a-b591-413e704abb7b/\n'
E         
E           /private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/0396fc53-d3f9-4e9a-b591-413e704abb7b/
E         +     .gitignore

test_public.py:931: AssertionError
FAILED [ 74%]
test_public.py:913 (test__tree__filter_by_extension__starts_with_dot__01[--extension])
('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/d6f686f2-ca4d-4565-ba56-3cb3a665b0a6/\n'
 '    .gitignore\n') != '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/d6f686f2-ca4d-4565-ba56-3cb3a665b0a6/\n'

<Click to see difference>

option = '--extension'
sandbox = PosixPath('/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/d6f686f2-ca4d-4565-ba56-3cb3a665b0a6')
capsys = <_pytest.capture.CaptureFixture object at 0x104351040>

    @pytest.mark.parametrize("option", ["-e", "--extension"])
    def test__tree__filter_by_extension__starts_with_dot__01(
        option: str, sandbox: Path, capsys: CaptureFixture
    ) -> None:
        """Кейс: многоуровневое расширение."""
        file = sandbox / ".gitignore"
        file.touch()
    
        main([option, ".gitignore", sandbox.as_posix()])
    
        captured = capsys.readouterr()
        stdout = captured.out
    
        expected = f"""\
        {sandbox.as_posix()}/
        """
    
>       assert stdout == dedent(expected)
E       AssertionError: assert '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/d6f686f2-ca4d-4565-ba56-3cb3a665b0a6/\n    .gitignore\n' == '/private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/d6f686f2-ca4d-4565-ba56-3cb3a665b0a6/\n'
E         
E           /private/var/folders/v1/dz46c90j3sd9yk1509w8z1vr0000gn/T/d6f686f2-ca4d-4565-ba56-3cb3a665b0a6/
E         +     .gitignore

test_public.py:931: AssertionError

test_public.py::test__tree__filter_by_extension__starts_with_dot__02[--extension] 
test_public.py::test__tree__filter_by_multiple_extensions__01[-e] PASSED [ 75%]PASSED [ 76%]
test_public.py::test__tree__filter_by_multiple_extensions__01[--extension] 
test_public.py::test__tree__filter_by_multiple_extensions__02[-e] PASSED [ 78%]PASSED [ 79%]
test_public.py::test__tree__filter_by_multiple_extensions__02[--extension] 
test_public.py::test__tree__filter_by_extension__prune__01[-e] PASSED [ 80%]PASSED [ 82%]
test_public.py::test__tree__filter_by_extension__prune__01[--extension] 
test_public.py::test__tree__filter_by_extension__prune__02[-e] PASSED    [ 83%]PASSED [ 84%]
test_public.py::test__tree__filter_by_extension__prune__02[--extension] 
test_public.py::test__tree__filter_by_extension__prune__03[-e] PASSED    [ 85%]PASSED [ 87%]
test_public.py::test__tree__filter_by_extension__prune__03[--extension] 
test_public.py::test__tree__multiple_options[-e--o--i] PASSED    [ 88%]PASSED [ 89%]PASSED            [ 91%]
test_public.py::test__tree__multiple_options[-e--o---indent] PASSED      [ 92%]
test_public.py::test__tree__multiple_options[-e---output--i] PASSED      [ 93%]
test_public.py::test__tree__multiple_options[-e---output---indent] PASSED [ 94%]
test_public.py::test__tree__multiple_options[--extension--o--i] PASSED   [ 96%]
test_public.py::test__tree__multiple_options[--extension--o---indent] PASSED [ 97%]
test_public.py::test__tree__multiple_options[--extension---output--i] PASSED [ 98%]
test_public.py::test__tree__multiple_options[--extension---output---indent] PASSED [100%]

======================== 17 failed, 61 passed in 0.34s =========================

Process finished with exit code 1

Исправь их

Главная ошибка - нам не нужно включать пустые файлы в вывод