zulip/zulip-terminal

Improve typing & test approach for widgets

Open

#1.576 geöffnet am 4. Apr. 2025

Auf GitHub ansehen
 (22 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Python (340 Forks)github user discovery
GSoCTRACKINGarea: refactoringarea: widgetshelp wanted

Repository-Metriken

Stars
 (841 Stars)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

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.

Contributor Guide