24 lines
659 B
Python
24 lines
659 B
Python
"""配置加载模块测试。"""
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
sys.path.insert(0, str(Path(__file__).parent.parent / "src"))
|
|
|
|
from config import get_language, load_config
|
|
|
|
|
|
class TestConfig:
|
|
"""测试配置加载模块。"""
|
|
|
|
def test_load_config_returns_dict(self) -> None:
|
|
"""测试 load_config 返回字典且包含 language 键。"""
|
|
config = load_config()
|
|
assert isinstance(config, dict)
|
|
assert "language" in config
|
|
|
|
def test_get_language_from_config(self) -> None:
|
|
"""测试 get_language 能正常返回语言设置。"""
|
|
language = get_language()
|
|
assert language is not None
|