"""测试文件检测工具函数。""" from utils import is_url, is_html_file class TestIsUrl: """测试 is_url 函数。""" def test_http_url(self): assert is_url("http://example.com") is True def test_https_url(self): assert is_url("https://example.com") is True def test_not_url(self): assert is_url("file.txt") is False class TestIsHtmlFile: """测试 is_html_file 函数。""" def test_html_extension(self): assert is_html_file("file.html") is True def test_htm_extension(self): assert is_html_file("file.htm") is True def test_uppercase_extension(self): assert is_html_file("FILE.HTML") is True def test_not_html(self): assert is_html_file("file.txt") is False