test: add config, format_msg, and Bot API tests

New test_config.py: merge, load, resolve_config tests.
Extend test_irc.py: format_msg edge cases (colon, empty, multi-param).
Extend test_plugin.py: Bot API via FakeConnection, _split_utf8 tests.
Test count: 92 -> 120.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
user
2026-02-15 03:27:18 +01:00
parent b48c289403
commit 8129b79cdb
3 changed files with 216 additions and 1 deletions

View File

@@ -128,3 +128,17 @@ class TestFormat:
def test_pong(self):
assert format_msg("PONG", "server.example.com") == "PONG :server.example.com"
def test_trailing_starts_with_colon(self):
result = format_msg("PRIVMSG", "#ch", ":)")
assert result == "PRIVMSG #ch ::)"
def test_empty_trailing(self):
# Empty string has no space and no leading colon, but head exists
result = format_msg("PRIVMSG", "#ch", "")
assert result == "PRIVMSG #ch "
def test_multi_param_mode(self):
# No space in tail, not starting with colon, head exists -> no colon
result = format_msg("MODE", "#ch", "+o", "nick")
assert result == "MODE #ch +o nick"