🔧 更新 Dockerfile 和 docker-compose 文件,添加配置目录并引入新依赖,重构配置加载功能
Some checks failed
Pytest API Testing / Pytes-API-Testing (push) Failing after 21s

This commit is contained in:
2025-04-28 15:03:56 +08:00
parent 20eb1809f1
commit a4e423168c
12 changed files with 248 additions and 6 deletions

View File

@@ -40,4 +40,30 @@ def test_load_from_toml():
result = config.load_from_toml(temp_file_path)
assert result["info"]["name"] == "LiteyukiBot"
assert result["info"]["version"] == "7.0.0"
assert result["info"]["version"] == "7.0.0"
def test_flatten_dict():
nested_dict = {
"name": "LiteyukiBot",
"version": {
"major": 7,
"minor": 0,
"patch": 0
},
"server": {
"db": {
"host": "localhost",
"port": 8080
},
"tags": ["tag1", "tag2"]
}
}
flat_dict = config.flatten_dict(nested_dict)
assert flat_dict["name"] == "LiteyukiBot"
assert flat_dict["version.major"] == 7
assert flat_dict["version.minor"] == 0
assert flat_dict["version.patch"] == 0
assert flat_dict["server.db.host"] == "localhost"
assert flat_dict["server.db.port"] == 8080
assert flat_dict["server.tags"] == ["tag1", "tag2"]