1. 删除了 test/unit/external_systems/framework/ 下的废弃空测试目录 2. 修复多处测试断言逻辑、参数传递与测试数据构造 3. 新增日志级别、缓存令牌、流事件等DTO单元测试 4. 补充路由绑定、会话仓储、outbox仓储的测试覆盖 5. 更新测试用例中的异常类型、参数校验与业务逻辑断言
40 lines
1012 B
Python
40 lines
1012 B
Python
"""logger.py DTO 单元测试。
|
|
|
|
覆盖 ``LogLevel`` 枚举的取值、字符串继承与成员完整性。
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
from yuxi.channels.contract.dtos.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
|