Skip to content

Improve typing & test approach for widgets #1576

@neiljp

Description

@neiljp

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions