Fix mypy errors.

This commit is contained in:
OK 2023-04-13 18:44:28 +02:00
parent 2508a12b44
commit 1ef9439906
2 changed files with 6 additions and 6 deletions

View File

@ -2,6 +2,6 @@
files = fjerkroa_bot, tests
ignore_missing_imports = True
strict_optional = True
warn_unused_ignores = True
warn_unused_ignores = False
warn_redundant_casts = True
warn_unused_configs = True

View File

@ -113,7 +113,7 @@ class TestFunctionality(TestBotBase):
message = self.create_message("Hello there! How are you?")
with patch.object(openai.ChatCompletion, 'acreate', new=acreate):
await self.bot.on_message(message)
message.channel.send.assert_called_once_with("Hello!", suppress_embeds=True)
message.channel.send.assert_called_once_with("Hello!", suppress_embeds=True) # type: ignore
async def test_on_message_stort_path(self) -> None:
async def acreate(*a, **kw):
@ -126,7 +126,7 @@ class TestFunctionality(TestBotBase):
return {'choices': [{'message': {'content': json.dumps(answer)}}]}
message = self.create_message("Hello there! How are you?")
message.author.name = 'madeup_name'
message.channel.name = 'some_channel'
message.channel.name = 'some_channel' # type: ignore
self.bot.config['short-path'] = [[r'some.*', r'madeup.*']]
with patch.object(openai.ChatCompletion, 'acreate', new=acreate):
await self.bot.on_message(message)
@ -136,7 +136,7 @@ class TestFunctionality(TestBotBase):
await self.bot.on_message(message)
self.assertEqual(self.bot.airesponder.history[-2]["content"],
'{"user": "different_name", "message": "Hello, how are you?", "channel": "some_channel", "direct": false}')
message.channel.send.assert_called_once_with("Hello!", suppress_embeds=True)
message.channel.send.assert_called_once_with("Hello!", suppress_embeds=True) # type: ignore
async def test_on_message_event2(self) -> None:
async def acreate(*a, **kw):
@ -150,7 +150,7 @@ class TestFunctionality(TestBotBase):
message = self.create_message("Hello there! How are you?")
with patch.object(openai.ChatCompletion, 'acreate', new=acreate):
await self.bot.on_message(message)
message.channel.send.assert_called_once_with("Hello!", suppress_embeds=True)
message.channel.send.assert_called_once_with("Hello!", suppress_embeds=True) # type: ignore
async def test_on_message_event3(self) -> None:
async def acreate(*a, **kw):
@ -205,7 +205,7 @@ class TestFunctionality(TestBotBase):
patch.object(logging, 'warning', logging_warning), \
patch.object(aiohttp.ClientSession, 'get', new=image):
await self.bot.on_message(message)
message.channel.send.assert_called_once_with("Hello!", files=[ANY], suppress_embeds=True)
message.channel.send.assert_called_once_with("Hello!", files=[ANY], suppress_embeds=True) # type: ignore
if __name__ == "__mait__":