From 314197e409a6d5e7978ebd45c5561b8f60b72171 Mon Sep 17 00:00:00 2001 From: dgw Date: Sun, 24 Sep 2023 18:07:29 -0500 Subject: [PATCH] coretasks, test: handle `core.modes` setting being `None` Add `None` to tested cases, as well, so if it goes back to throwing an error after future changes we'll find out about it. --- sopel/coretasks.py | 6 +++++- test/test_coretasks.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sopel/coretasks.py b/sopel/coretasks.py index 00fa683b0..45e935154 100644 --- a/sopel/coretasks.py +++ b/sopel/coretasks.py @@ -463,8 +463,11 @@ def handle_isupport(bot, trigger): if not botmode_support and 'BOT' in bot.isupport: # yes it was! set our mode unless the config overrides it botmode = bot.isupport['BOT'] - if botmode not in bot.config.core.modes: + modes_setting = bot.config.core.modes + + if not modes_setting or botmode not in bot.config.core.modes: bot.write(('MODE', bot.nick, '+' + botmode)) + # was NAMESX support status updated? if not namesx_support and 'NAMESX' in bot.isupport: # yes it was! @@ -472,6 +475,7 @@ def handle_isupport(bot, trigger): # and the multi-prefix capability is not enabled # so we can ask the server to use the NAMESX feature bot.write(('PROTOCTL', 'NAMESX')) + # was UHNAMES support status updated? if not uhnames_support and 'UHNAMES' in bot.isupport: # yes it was! diff --git a/test/test_coretasks.py b/test/test_coretasks.py index 3a1a1f38a..c01174e1b 100644 --- a/test/test_coretasks.py +++ b/test/test_coretasks.py @@ -361,7 +361,7 @@ def test_handle_isupport_chantypes(mockbot): assert mockbot.make_identifier('!channel').is_nick() -@pytest.mark.parametrize('modes', ['', 'Rw']) +@pytest.mark.parametrize('modes', [None, '', 'Rw']) def test_handle_isupport_bot_mode(mockbot, modes): mockbot.config.core.modes = modes