Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
FasterSpeeding committed Dec 28, 2023
1 parent d0529bc commit d58ce2c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tanjun/_internal/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/test_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand Down

0 comments on commit d58ce2c

Please sign in to comment.