ForcePilot/backend/test/unit/channels/contract/dtos/test_logger.py
Kris 08617091dc refactor: 整理项目包结构与导入路径
- 新增多个业务域的__init__.py模块文件,规范包导出结构
- 调整多个DTO文件的导入路径,统一模块组织方式
- 移除测试文件中多余的空行与导入语句
- 优化部分业务模块的包层级划分
2026-07-18 02:04:03 +08:00

40 lines
1019 B
Python

"""logger.py DTO 单元测试。
覆盖 ``LogLevel`` 枚举的取值、字符串继承与成员完整性。
"""
from __future__ import annotations
import pytest
from yuxi.channels.contract.dtos.shared.logger import LogLevel
pytestmark = pytest.mark.unit
@pytest.mark.unit
class TestLogLevel:
"""日志级别枚举测试。"""
def test_enum_values_are_correct(self):
# Arrange
# Act
# Assert - 校验四个枚举成员的字符串值
assert LogLevel.DEBUG == "debug"
assert LogLevel.INFO == "info"
assert LogLevel.WARN == "warn"
assert LogLevel.ERROR == "error"
def test_enum_inherits_from_str(self):
# Arrange
# Act
# Assert - StrEnum 应继承 str 并支持字符串比较
assert issubclass(LogLevel, str)
assert isinstance(LogLevel.INFO, str)
def test_enum_has_four_members(self):
# Arrange
# Act
members = list(LogLevel)
# Assert
assert len(members) == 4