"""测试 HTML 下载器模块。"""
import pytest
from unittest.mock import patch, MagicMock
from readers.html.downloader import download_html
from readers.html.downloader import pyppeteer, selenium, httpx, urllib
class TestDownloadHtml:
"""测试 download_html 统一入口函数。"""
def test_download_html_module_importable(self):
"""测试 download_html 函数可以正常导入和调用。"""
# 只要不抛异常就可以
assert callable(download_html)
def test_downloaders_available(self):
"""测试各下载器模块可用。"""
assert callable(pyppeteer.download)
assert callable(selenium.download)
assert callable(httpx.download)
assert callable(urllib.download)
class TestIndividualDownloaders:
"""测试单个下载器模块。"""
def test_pyppeteer_download_callable(self):
"""测试 pyppeteer.download 可以调用。"""
assert callable(pyppeteer.download)
def test_selenium_download_callable(self):
"""测试 selenium.download 可以调用。"""
assert callable(selenium.download)
def test_httpx_download_callable(self):
"""测试 httpx.download 可以调用。"""
assert callable(httpx.download)
def test_urllib_download_callable(self):
"""测试 urllib.download 可以调用(标准库)。"""
assert callable(urllib.download)