- 更新 openspec/config.yaml 中 git 任务相关说明 - 将 scripts.core.* 改为 core.*,scripts.readers.* 改为 readers.* - 优化 lyxy_document_reader.py 中 sys.path 设置方式 - 同步更新所有测试文件的导入路径
33 lines
772 B
Python
33 lines
772 B
Python
"""测试文件检测工具函数。"""
|
|
|
|
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
|