Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
typing: Add assertions for Optional values.
Zixuan James Li56855e01877f
diff --git a/zerver/models.py b/zerver/models.pyindex b8b6a9a0d3e..690166537f8 100644--- a/zerver/models.py+++ b/zerver/models.py@@ -3795,6 +3795,7 @@ def bot_owner_user_ids(user_profile: UserProfile) -> Set[int]:and user_profile.default_events_register_stream.invite_only)if is_private_bot:+ assert user_profile.bot_owner_id is not Nonereturn {user_profile.bot_owner_id}else:users = {user.id for user in user_profile.realm.get_human_admin_users()}diff --git a/zerver/tests/test_link_embed.py b/zerver/tests/test_link_embed.pyindex 284c835c569..7243c507ead 100644--- a/zerver/tests/test_link_embed.py+++ b/zerver/tests/test_link_embed.py@@ -403,6 +403,7 @@ class PreviewTestCase(ZulipTestCase):# Verify the initial message doesn't have the embedded links renderedmsg = Message.objects.select_related("sender").get(id=msg_id)+ assert msg.rendered_content is not Noneself.assertNotIn(f'<a href="{url}" title="The Rock">The Rock</a>', msg.rendered_content)self.create_mock_response(url, relative_url=relative_url)@@ -449,6 +450,7 @@ class PreviewTestCase(ZulipTestCase):in info_logs.output[0])msg = Message.objects.select_related("sender").get(id=msg_id)+ assert msg.rendered_content is not None# The content of the message has changed since the event for original_url has been created,# it should not be rendered. Another, up-to-date event will have been sent (edited_url).self.assertNotIn(