- validate_back_to_reservation / cleanup_expired_reservations 函数签名验证 - reservation_logic 全部 6 个子模块存在性测试 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
88 lines
2.5 KiB
Python
88 lines
2.5 KiB
Python
"""reservation_logic.cleanup_validate 子模块单元测试。
|
|
|
|
覆盖:
|
|
- validate_back_to_reservation 函数签名
|
|
- cleanup_expired_reservations 函数签名
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import inspect
|
|
import pytest
|
|
|
|
|
|
class TestValidateBackToReservation:
|
|
"""validate_back_to_reservation 函数测试。"""
|
|
|
|
def test_function_exists(self):
|
|
from douyin.reservation.reservation_logic.cleanup_validate import (
|
|
validate_back_to_reservation,
|
|
)
|
|
|
|
assert callable(validate_back_to_reservation)
|
|
|
|
def test_function_signature(self):
|
|
from douyin.reservation.reservation_logic.cleanup_validate import (
|
|
validate_back_to_reservation,
|
|
)
|
|
|
|
sig = inspect.signature(validate_back_to_reservation)
|
|
params = list(sig.parameters.keys())
|
|
assert "analyser" in params
|
|
assert "reservations" in params
|
|
|
|
|
|
class TestCleanupExpiredReservations:
|
|
"""cleanup_expired_reservations 函数测试。"""
|
|
|
|
def test_function_exists(self):
|
|
from douyin.reservation.reservation_logic.cleanup_validate import (
|
|
cleanup_expired_reservations,
|
|
)
|
|
|
|
assert callable(cleanup_expired_reservations)
|
|
|
|
def test_function_signature(self):
|
|
from douyin.reservation.reservation_logic.cleanup_validate import (
|
|
cleanup_expired_reservations,
|
|
)
|
|
|
|
sig = inspect.signature(cleanup_expired_reservations)
|
|
params = list(sig.parameters.keys())
|
|
assert "analyser" in params
|
|
assert "reservations" in params
|
|
|
|
|
|
class TestReservationLogicSubmodules:
|
|
"""reservation_logic 子模块存在性测试。"""
|
|
|
|
def test_cleanup_validate_importable(self):
|
|
from douyin.reservation.reservation_logic import cleanup_validate
|
|
|
|
assert cleanup_validate is not None
|
|
|
|
def test_helpers_importable(self):
|
|
from douyin.reservation.reservation_logic import helpers
|
|
|
|
assert helpers is not None
|
|
|
|
def test_add_importable(self):
|
|
from douyin.reservation.reservation_logic import add
|
|
|
|
assert add is not None
|
|
|
|
def test_record_importable(self):
|
|
from douyin.reservation.reservation_logic import record
|
|
|
|
assert record is not None
|
|
|
|
def test_queue_full_importable(self):
|
|
from douyin.reservation.reservation_logic import queue_full
|
|
|
|
assert queue_full is not None
|
|
|
|
def test_attend_window_importable(self):
|
|
from douyin.reservation.reservation_logic import attend_window
|
|
|
|
assert attend_window is not None
|