From d58ce2ce2b6440766ad5fd2a09c5083cde9cd1db Mon Sep 17 00:00:00 2001 From: Faster Speeding Date: Thu, 28 Dec 2023 02:52:25 +0000 Subject: [PATCH] test fixes --- tanjun/_internal/cache.py | 4 ++-- tests/test_conversion.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tanjun/_internal/cache.py b/tanjun/_internal/cache.py index 07cbceec1..e0e0d82dc 100644 --- a/tanjun/_internal/cache.py +++ b/tanjun/_internal/cache.py @@ -77,9 +77,9 @@ async def get_perm_channel(client: tanjun.Client, channel_id: hikari.Snowflake, thread_cache = client.injector.get_type_dependency(_ThreadCacheT) if thread_cache: # noqa: SIM102 # Has to be nested cause of pyright bug: - if (thread := await thread_cache.get(channel_id, default=None)) and client.cache: # noqa: SIM102 + if thread := await thread_cache.get(channel_id, default=None): # noqa: SIM102 # Has to be nested cause of pyright bug. - if channel := client.cache.get_guild_channel(thread.parent_id): + if client.cache and (channel := client.cache.get_guild_channel(thread.parent_id)): return channel channel_id = thread.parent_id diff --git a/tests/test_conversion.py b/tests/test_conversion.py index 57c171cdb..4bbc58fbf 100644 --- a/tests/test_conversion.py +++ b/tests/test_conversion.py @@ -1094,7 +1094,7 @@ async def test___call___when_async_hit(self): assert result is mock_cache.get.return_value mock_context.cache.get_invite.assert_called_once_with("asdbasd") - mock_cache.get.assert_awaited_once_with("asdbasd") + mock_cache.get.assert_awaited_once_with("asdbasd", default=None) @pytest.mark.asyncio() async def test___call___when_not_cached(self): @@ -1107,7 +1107,7 @@ async def test___call___when_not_cached(self): await tanjun.to_invite_with_metadata("dsds", mock_context, cache=mock_cache) mock_context.cache.get_invite.assert_called_once_with("dsds") - mock_cache.get.assert_called_once_with("dsds") + mock_cache.get.assert_called_once_with("dsds", default=None) @pytest.mark.asyncio() async def test___call___when_cacheless(self):