diff --git a/tests/unit/test_douyin_url_extract.py b/tests/unit/test_douyin_url_extract.py index 84ed2e687..1ee9311b0 100644 --- a/tests/unit/test_douyin_url_extract.py +++ b/tests/unit/test_douyin_url_extract.py @@ -3,13 +3,13 @@ from __future__ import annotations import pytest -from fastapi import HTTPException, status # 直接 import 模块,用 _extract_url_from_text / _extract_and_validate_douyin_url 测试 from app.api.routes.scripts_ai import ( _extract_and_validate_douyin_url, _extract_url_from_text, ) +from fastapi import HTTPException, status class TestExtractUrlFromText: diff --git a/tests/unit/test_extract_from_douyin_errors.py b/tests/unit/test_extract_from_douyin_errors.py index 10a0ab267..f806f1e00 100644 --- a/tests/unit/test_extract_from_douyin_errors.py +++ b/tests/unit/test_extract_from_douyin_errors.py @@ -337,7 +337,9 @@ def test_ydl_opts_includes_cookiefile_when_file_exists(fake_user): ): scripts_ai.extract_from_douyin(request=body, current_user=fake_user, db=mock.MagicMock()) - assert captured_opts_download.get("cookiefile") == "/tmp/fake_cookies.txt", f"cookiefile 应被设置,opts={captured_opts_download}" + assert ( + captured_opts_download.get("cookiefile") == "/tmp/fake_cookies.txt" + ), f"cookiefile 应被设置,opts={captured_opts_download}" def test_ydl_opts_no_cookiefile_when_file_missing(fake_user): @@ -369,7 +371,9 @@ def test_ydl_opts_no_cookiefile_when_file_missing(fake_user): ): scripts_ai.extract_from_douyin(request=body, current_user=fake_user, db=mock.MagicMock()) - assert "cookiefile" not in captured_opts_download, f"cookies 文件缺失时不应设置 cookiefile,opts={captured_opts_download}" + assert ( + "cookiefile" not in captured_opts_download + ), f"cookies 文件缺失时不应设置 cookiefile,opts={captured_opts_download}" def test_generic_download_error_hides_raw_message(fake_user):