微信小程序页面迁移校验之前 P5任务处理之前

This commit is contained in:
Neo
2026-03-09 01:19:21 +08:00
parent 263bf96035
commit 6e20987d2f
1112 changed files with 153824 additions and 219694 deletions

View File

@@ -22,3 +22,32 @@ def test_config_get_nested():
config = AppConfig.load({"app": {"store_id": 1}})
assert config.get("db.batch_size") == 1000
assert config.get("nonexistent.key", "default") == "default"
def test_business_day_start_hour_default():
"""默认值 8 应正常加载"""
config = AppConfig.load({"app": {"store_id": 1}})
assert config.get("app.business_day_start_hour") == 8
def test_business_day_start_hour_valid_range():
"""023 范围内的整数应正常加载"""
for h in (0, 12, 23):
config = AppConfig.load({"app": {"store_id": 1, "business_day_start_hour": h}})
assert config.get("app.business_day_start_hour") == h
def test_business_day_start_hour_out_of_range():
"""超出 023 范围应抛出 SystemExit"""
with pytest.raises(SystemExit, match="business_day_start_hour"):
AppConfig.load({"app": {"store_id": 1, "business_day_start_hour": 24}})
with pytest.raises(SystemExit, match="business_day_start_hour"):
AppConfig.load({"app": {"store_id": 1, "business_day_start_hour": -1}})
def test_business_day_start_hour_non_int():
"""非整数类型应抛出 SystemExit"""
with pytest.raises(SystemExit, match="business_day_start_hour"):
AppConfig.load({"app": {"store_id": 1, "business_day_start_hour": "8"}})
with pytest.raises(SystemExit, match="business_day_start_hour"):
AppConfig.load({"app": {"store_id": 1, "business_day_start_hour": 8.0}})