From b343381fea3eab26e334a1b3bba202d715f9ea2e Mon Sep 17 00:00:00 2001 From: salmonik Date: Sun, 19 Apr 2026 15:44:33 +0200 Subject: test: improve test assertions and edge cases --- tests/cogs/test_tts.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'tests/cogs/test_tts.py') diff --git a/tests/cogs/test_tts.py b/tests/cogs/test_tts.py index 8c95670..de68580 100644 --- a/tests/cogs/test_tts.py +++ b/tests/cogs/test_tts.py @@ -16,10 +16,10 @@ async def test_tts_file_output(tts_cog, mock_channel, mock_guild, bot, mock_user ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) ctx.user = mock_user ctx.author = mock_user - - mock_temp_path = "/tmp/test_tts.mp3" - - with patch('cogs.tts.gTTS') as mock_gtts: + + "/tmp/test_tts.mp3" + + with patch('cogs.tts.gTTS') as _: with patch('os.path.exists', return_value=True): with patch('os.unlink'): with patch.object(ctx, 'respond', new_callable=AsyncMock) as mock_respond: @@ -34,7 +34,7 @@ async def test_tts_voice_output_not_in_channel(tts_cog, mock_channel, mock_guild ctx.user = mock_user ctx.author = mock_user ctx.author.voice = None - + with patch('cogs.tts.gTTS'): with patch('os.path.exists', return_value=True): with patch('os.unlink'): @@ -48,11 +48,11 @@ async def test_tts_error_handling(tts_cog, mock_channel, mock_guild, bot, mock_u ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) ctx.user = mock_user ctx.author = mock_user - + with patch('cogs.tts.gTTS', side_effect=Exception("TTS Error")): with patch('os.path.exists', return_value=False): with patch.object(ctx, 'respond', new_callable=AsyncMock) as mock_respond: await tts_cog.tts.callback(tts_cog, ctx, text="Hello", output="file") mock_respond.assert_called_once() args = mock_respond.call_args - assert "Error" in str(args) or "eror" in str(args) \ No newline at end of file + assert "Error" in str(args) or "eror" in str(args) -- cgit v1.2.3