Fix mypy errors.
This commit is contained in:
parent
2508a12b44
commit
1ef9439906
2
mypy.ini
2
mypy.ini
@ -2,6 +2,6 @@
|
|||||||
files = fjerkroa_bot, tests
|
files = fjerkroa_bot, tests
|
||||||
ignore_missing_imports = True
|
ignore_missing_imports = True
|
||||||
strict_optional = True
|
strict_optional = True
|
||||||
warn_unused_ignores = True
|
warn_unused_ignores = False
|
||||||
warn_redundant_casts = True
|
warn_redundant_casts = True
|
||||||
warn_unused_configs = True
|
warn_unused_configs = True
|
||||||
|
|||||||
@ -113,7 +113,7 @@ class TestFunctionality(TestBotBase):
|
|||||||
message = self.create_message("Hello there! How are you?")
|
message = self.create_message("Hello there! How are you?")
|
||||||
with patch.object(openai.ChatCompletion, 'acreate', new=acreate):
|
with patch.object(openai.ChatCompletion, 'acreate', new=acreate):
|
||||||
await self.bot.on_message(message)
|
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 test_on_message_stort_path(self) -> None:
|
||||||
async def acreate(*a, **kw):
|
async def acreate(*a, **kw):
|
||||||
@ -126,7 +126,7 @@ class TestFunctionality(TestBotBase):
|
|||||||
return {'choices': [{'message': {'content': json.dumps(answer)}}]}
|
return {'choices': [{'message': {'content': json.dumps(answer)}}]}
|
||||||
message = self.create_message("Hello there! How are you?")
|
message = self.create_message("Hello there! How are you?")
|
||||||
message.author.name = 'madeup_name'
|
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.*']]
|
self.bot.config['short-path'] = [[r'some.*', r'madeup.*']]
|
||||||
with patch.object(openai.ChatCompletion, 'acreate', new=acreate):
|
with patch.object(openai.ChatCompletion, 'acreate', new=acreate):
|
||||||
await self.bot.on_message(message)
|
await self.bot.on_message(message)
|
||||||
@ -136,7 +136,7 @@ class TestFunctionality(TestBotBase):
|
|||||||
await self.bot.on_message(message)
|
await self.bot.on_message(message)
|
||||||
self.assertEqual(self.bot.airesponder.history[-2]["content"],
|
self.assertEqual(self.bot.airesponder.history[-2]["content"],
|
||||||
'{"user": "different_name", "message": "Hello, how are you?", "channel": "some_channel", "direct": false}')
|
'{"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 test_on_message_event2(self) -> None:
|
||||||
async def acreate(*a, **kw):
|
async def acreate(*a, **kw):
|
||||||
@ -150,7 +150,7 @@ class TestFunctionality(TestBotBase):
|
|||||||
message = self.create_message("Hello there! How are you?")
|
message = self.create_message("Hello there! How are you?")
|
||||||
with patch.object(openai.ChatCompletion, 'acreate', new=acreate):
|
with patch.object(openai.ChatCompletion, 'acreate', new=acreate):
|
||||||
await self.bot.on_message(message)
|
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 test_on_message_event3(self) -> None:
|
||||||
async def acreate(*a, **kw):
|
async def acreate(*a, **kw):
|
||||||
@ -205,7 +205,7 @@ class TestFunctionality(TestBotBase):
|
|||||||
patch.object(logging, 'warning', logging_warning), \
|
patch.object(logging, 'warning', logging_warning), \
|
||||||
patch.object(aiohttp.ClientSession, 'get', new=image):
|
patch.object(aiohttp.ClientSession, 'get', new=image):
|
||||||
await self.bot.on_message(message)
|
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__":
|
if __name__ == "__mait__":
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user