fix lint and formatting violations in tests and source
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
"""Tests for configuration module."""
|
||||
|
||||
from tuimble.config import (
|
||||
AudioConfig, Config, PttConfig, ServerConfig,
|
||||
_load_section, load_config,
|
||||
AudioConfig,
|
||||
Config,
|
||||
PttConfig,
|
||||
ServerConfig,
|
||||
_load_section,
|
||||
load_config,
|
||||
)
|
||||
|
||||
|
||||
@@ -55,11 +59,14 @@ def test_server_cert_custom():
|
||||
|
||||
def test_load_section_filters_unknown_keys():
|
||||
"""Unknown keys are silently dropped, valid keys are kept."""
|
||||
result = _load_section(ServerConfig, {
|
||||
"host": "example.com",
|
||||
"typo_field": "oops",
|
||||
"another_bad": 42,
|
||||
})
|
||||
result = _load_section(
|
||||
ServerConfig,
|
||||
{
|
||||
"host": "example.com",
|
||||
"typo_field": "oops",
|
||||
"another_bad": 42,
|
||||
},
|
||||
)
|
||||
assert result.host == "example.com"
|
||||
assert result.port == 64738 # default preserved
|
||||
|
||||
@@ -86,8 +93,7 @@ def test_load_config_with_unknown_keys(tmp_path):
|
||||
"""Config file with unknown keys loads without error."""
|
||||
toml = tmp_path / "config.toml"
|
||||
toml.write_text(
|
||||
'[server]\nhost = "example.com"\nbogus = true\n'
|
||||
'[ptt]\nfuture_option = "x"\n'
|
||||
'[server]\nhost = "example.com"\nbogus = true\n[ptt]\nfuture_option = "x"\n'
|
||||
)
|
||||
cfg = load_config(toml)
|
||||
assert cfg.server.host == "example.com"
|
||||
|
||||
Reference in New Issue
Block a user