zulip/zulip-terminal

Improve typing & test approach for widgets

Open

#1,576 创建于 2025年4月4日

在 GitHub 查看
 (22 评论) (0 反应) (0 负责人)Python (340 fork)github user discovery
GSoCTRACKINGarea: refactoringarea: widgetshelp wanted

仓库指标

Star
 (841 star)
PR 合并指标
 (PR 指标待抓取)

描述

Following up on earlier work on polls and todo widget handling in messages, this could involve:

  • Use TypedDict (or dataclass) for the result of process_todo_widget (and for polls) instead of a nested dict with a union.
  • Consider if the extracted JSON should match specific types, that we can define using TypedDict or similar too.
  • Consider factory fixtures for the Submessage content in tests.
  • Move Submessage into api_types.py, and use it to improve the definition of Message.

See # zulip-terminal > Widget followup work for the original listing of these points and for followup discussion. These points arose in earlier work on widget implementation, so you might read those PRs to understand the background further.

贡献者指南