zulip/zulip-terminal

Improve typing & test approach for widgets

Open

#1576 aperta il 4 apr 2025

Vedi su GitHub
 (22 commenti) (0 reazioni) (0 assegnatari)Python (340 fork)github user discovery
GSoCTRACKINGarea: refactoringarea: widgetshelp wanted

Metriche repository

Star
 (841 star)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

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.

Guida contributor