mirror of
https://github.com/LiteyukiStudio/LiteyukiBot.git
synced 2025-10-04 17:36:23 +00:00
🔧 更新 Dockerfile 和 docker-compose 文件,添加配置目录并引入新依赖,重构配置加载功能
Some checks failed
Pytest API Testing / Pytes-API-Testing (push) Failing after 21s
Some checks failed
Pytest API Testing / Pytes-API-Testing (push) Failing after 21s
This commit is contained in:
@@ -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"]
|
Reference in New Issue
Block a user