Skip to content

Commit

Permalink
maybe fix?
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuang11 committed Jan 10, 2025
1 parent 1d1b206 commit f59003d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion panel/tests/chat/test_feed.py
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,16 @@ def callback(msg, user, instance):
chat_feed.send("Message", respond=True)
await async_wait_until(lambda: len(chat_feed.objects) == 1)

def test_callback_exception_raise(self, chat_feed):
def callback(msg, user, instance):
return 1 / 0

chat_feed.callback = callback
chat_feed.callback_exception = "raise"
with pytest.raises(ZeroDivisionError, match="division by zero"):
chat_feed.send("Message", respond=True)
wait_until(lambda: len(chat_feed.objects) == 1)

async def test_callback_exception_callable(self, chat_feed):
def callback(msg, user, instance):
raise ValueError("Expected error")
Expand All @@ -1108,7 +1118,7 @@ def exception_callback(exception, instance):
chat_feed.callback = callback
chat_feed.callback_exception = exception_callback
chat_feed.send("Message", respond=True)
wait_until(lambda: len(chat_feed.objects) == 2)
await async_wait_until(lambda: len(chat_feed.objects) == 2)
assert chat_feed.objects[-1].object == "The exception: Expected error"

def test_callback_exception_invalid_option(self, chat_feed):
Expand Down

0 comments on commit f59003d

Please sign in to comment.