Refactor code structure for improved readability and maintainability
CI / Quality Checks (push) Failing after 9s
CI / Test Suite (push) Successful in 10s

This commit is contained in:
ВяткинАртём
2026-05-27 17:06:39 +03:00
parent d06bd989f3
commit 59aaa9c4d7
31 changed files with 1416 additions and 543 deletions
+8 -2
View File
@@ -14,7 +14,12 @@ def test_cli_prints_downloaded_path(
tmp_path: Path,
) -> None:
expected_path = tmp_path / "video.mp4"
monkeypatch.setattr(cli, "download", lambda **kwargs: expected_path)
def fake_download_to_path(**kwargs: object) -> Path:
del kwargs
return expected_path
monkeypatch.setattr(cli, "download_to_path", fake_download_to_path)
exit_code = cli.main(
[
@@ -33,9 +38,10 @@ def test_cli_prints_downloaded_path(
def test_cli_exits_with_error(monkeypatch: pytest.MonkeyPatch) -> None:
def raise_error(**kwargs: object) -> Path:
del kwargs
raise InvalidSessionError("session error")
monkeypatch.setattr(cli, "download", raise_error)
monkeypatch.setattr(cli, "download_to_path", raise_error)
with pytest.raises(SystemExit) as exc_info:
cli.main(["https://youtube.com/shorts/example", "cookies.txt"])