Files
douyin_guaji-main/tests/unit/test_version.py
T
Your Name e68f1dd3de feat: Refactor coverage management and enhance logging functionality
- Removed the `.coverage` file from the repository to streamline coverage management.
- Updated `.gitignore` to exclude coverage-related files and directories, ensuring a cleaner project structure.
- Introduced new scripts for checking GPU availability and detecting GUI parameter conflicts, enhancing the overall functionality of the application.
- Improved logging mechanisms across various modules to support better debugging and monitoring.
- Added comprehensive documentation for new features and updated existing markdown files for clarity.
2025-12-23 02:38:51 +08:00

62 lines
1.6 KiB
Python

"""
版本信息模块测试
"""
import pytest
from version import VERSION, RELEASE_DATE, print_version_banner
class TestVersion:
"""版本信息测试类"""
def test_version_exists(self):
"""测试版本号存在"""
assert VERSION is not None
assert isinstance(VERSION, str)
assert len(VERSION) > 0
def test_version_format(self):
"""测试版本号格式(应该是 x.y.z 格式)"""
parts = VERSION.split(".")
assert len(parts) >= 2, "版本号应该至少包含主版本号和次版本号"
for part in parts:
assert part.isdigit() or part.replace("-", "").isdigit(), f"版本号部分 '{part}' 应该是数字"
def test_release_date_exists(self):
"""测试发布日期存在"""
assert RELEASE_DATE is not None
assert isinstance(RELEASE_DATE, str)
assert len(RELEASE_DATE) > 0
def test_release_date_format(self):
"""测试发布日期格式(应该是 YYYY-MM-DD 格式)"""
parts = RELEASE_DATE.split("-")
assert len(parts) == 3, "发布日期应该是 YYYY-MM-DD 格式"
assert len(parts[0]) == 4, "年份应该是4位数字"
assert len(parts[1]) == 2, "月份应该是2位数字"
assert len(parts[2]) == 2, "日期应该是2位数字"
def test_print_version_banner(self, capsys):
"""测试版本信息打印"""
print_version_banner()
captured = capsys.readouterr()
assert VERSION in captured.out
assert RELEASE_DATE in captured.out